Bläddra i källkod

HMLG scan order 1.24
Modify app frame
iOS 16 compatible
Add price group logic
Fix bug

Ray Zhang 3 år sedan
förälder
incheckning
6907a36a8a
44 ändrade filer med 2337 tillägg och 1163 borttagningar
  1. 10 214
      RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj
  2. 1 1
      RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist
  3. 2 2
      RedAnt ERP Mobile/HMLG Scan Order/Base.lproj/Main.storyboard
  4. 133 117
      RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m
  5. 18 0
      RedAnt ERP Mobile/HMLG Scan Order/PriceGroupListViewController.h
  6. 84 0
      RedAnt ERP Mobile/HMLG Scan Order/PriceGroupListViewController.m
  7. 57 4
      RedAnt ERP Mobile/HMLG Scan Order/SO.storyboard
  8. 1 0
      RedAnt ERP Mobile/HMLG Scan Order/ScanDiscountViewController.h
  9. 4 1
      RedAnt ERP Mobile/HMLG Scan Order/ScanDiscountViewController.m
  10. 51 25
      RedAnt ERP Mobile/HMLG Scan Order/ScanListCell.m
  11. 44 20
      RedAnt ERP Mobile/HMLG Scan Order/ScanModelListCell.m
  12. 2 0
      RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.h
  13. 59 1
      RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m
  14. 3 1
      RedAnt ERP Mobile/HMLG Scan Order/SetupServerViewController.m
  15. 5 3
      RedAnt ERP Mobile/HMLG Scan Order/StockViewController.m
  16. 3 1
      RedAnt ERP Mobile/HMLG Scan Order/config.h
  17. 13 5
      RedAnt ERP Mobile/common/AppDelegateBase.h
  18. 63 42
      RedAnt ERP Mobile/common/AppDelegateBase.m
  19. 2 0
      RedAnt ERP Mobile/common/ERPUtils.m
  20. 1 1
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  21. 265 173
      RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m
  22. 1 1
      RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m
  23. 1 0
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.h
  24. 332 182
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  25. 9 4
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.h
  26. 636 183
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m
  27. 164 47
      RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m
  28. 2 0
      RedAnt ERP Mobile/common/NotificationNameCenter.m
  29. 1 1
      RedAnt ERP Mobile/common/RASingleton.h
  30. 9 0
      RedAnt ERP Mobile/common/data_provider/RADataProvider.h
  31. 152 8
      RedAnt ERP Mobile/common/data_provider/RADataProvider.m
  32. 3 0
      RedAnt ERP Mobile/common/data_provider/RANetwork.h
  33. 43 1
      RedAnt ERP Mobile/common/data_provider/RANetwork.m
  34. 0 6
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/project.pbxproj
  35. 1 1
      RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist
  36. 0 6
      RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj
  37. 38 11
      RedAnt ERP Mobile/iSales-NPD/Base.lproj/OLM.storyboard
  38. 3 2
      RedAnt ERP Mobile/iSales-NPD/config.h
  39. 12 0
      RedAnt ERP Mobile/iSales-TRADESHOW.xcodeproj/project.pbxproj
  40. 12 1
      RedAnt ERP Mobile/iSales-TRADESHOW/config.h
  41. 0 6
      RedAnt ERP Mobile/iSales-UNITED WAVER.xcodeproj/project.pbxproj
  42. 0 6
      RedAnt ERP Mobile/iSales-USAI.xcodeproj/project.pbxproj
  43. 86 85
      RedAnt ERP Mobile/iSales-USAI/config.h
  44. 11 1
      RedAnt ERP Mobile/iSales-UWAVER/config.h

+ 10 - 214
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj

@@ -10,6 +10,7 @@
 		3C16916C27FE7E3000026FE5 /* SignUpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C16916B27FE7E3000026FE5 /* SignUpViewController.m */; };
 		3C16916F280004E000026FE5 /* ChangePasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C16916E280004E000026FE5 /* ChangePasswordViewController.m */; };
 		3C2D0483285B242800423D97 /* ScanDiscountViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2D0482285B242800423D97 /* ScanDiscountViewController.m */; };
+		3C2F437B28B748E800F50E0E /* PriceGroupListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F437A28B748E800F50E0E /* PriceGroupListViewController.m */; };
 		3C2F99B8237BE1790000808F /* PortfolioListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */; };
 		3C3A5AFE27D74E50005F4EFB /* ScanResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3A5AFD27D74E4F005F4EFB /* ScanResultViewController.m */; };
 		3C3A5B0127D74F91005F4EFB /* ScanOrderScanModelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3A5B0027D74F91005F4EFB /* ScanOrderScanModelViewController.m */; };
@@ -126,19 +127,10 @@
 		4295AE1C1FE74D46007BE365 /* CommonEditorAutoCompleteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4295AE1A1FE74D46007BE365 /* CommonEditorAutoCompleteView.m */; };
 		4295AE1D1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4295AE1B1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib */; };
 		42B309791E45BA32007AFC62 /* status_filter_cadedate_po.json in Resources */ = {isa = PBXBuildFile; fileRef = 42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */; };
-		42BEF34F1E89FE1100632AB6 /* FirebaseAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF3241E89FE1100632AB6 /* FirebaseAnalytics.framework */; };
-		42BEF3501E89FE1100632AB6 /* FirebaseCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF3271E89FE1100632AB6 /* FirebaseCore.framework */; };
-		42BEF3521E89FE1200632AB6 /* FirebaseInstanceID.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF32B1E89FE1100632AB6 /* FirebaseInstanceID.framework */; };
-		42BEF3541E89FE1200632AB6 /* GGLAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF32F1E89FE1100632AB6 /* GGLAnalytics.framework */; };
-		42BEF3551E89FE1200632AB6 /* GGLCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF3301E89FE1100632AB6 /* GGLCore.framework */; };
-		42BEF3571E89FE1200632AB6 /* libGoogleAnalytics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF33C1E89FE1100632AB6 /* libGoogleAnalytics.a */; };
-		42BEF3581E89FE1200632AB6 /* GTMNSData+zlib.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BEF34B1E89FE1100632AB6 /* GTMNSData+zlib.m */; };
 		42BEF35D1E89FECD00632AB6 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF35C1E89FECD00632AB6 /* SystemConfiguration.framework */; };
 		42BEF35F1E89FEE300632AB6 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF35E1E89FEE300632AB6 /* CoreData.framework */; };
-		42BEF3621E8A005800632AB6 /* GoogleAnalyst.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BEF3611E8A005800632AB6 /* GoogleAnalyst.m */; };
 		42BF67CC1E5179970081F90A /* ERPUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BF67CB1E5179970081F90A /* ERPUtils.m */; };
 		42D9A0231EB02DA6008AF7AF /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42D9A0221EB02DA6008AF7AF /* AdSupport.framework */; };
-		42D9A0251EB03994008AF7AF /* libAdIdAccess.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42D9A0241EB03994008AF7AF /* libAdIdAccess.a */; };
 		42DC12F11F0CD98E00A4C011 /* OrderDetailPickInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DC12F01F0CD98E00A4C011 /* OrderDetailPickInfoCell.m */; };
 		42E489611EE63F4E007256A0 /* more_color_64.png in Resources */ = {isa = PBXBuildFile; fileRef = 42E489601EE63F4E007256A0 /* more_color_64.png */; };
 		42FD1A031FBD1A3000C5D9A8 /* RAOrderPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42FD1A021FBD1A3000C5D9A8 /* RAOrderPreviewController.m */; };
@@ -348,6 +340,8 @@
 		3C16916E280004E000026FE5 /* ChangePasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChangePasswordViewController.m; sourceTree = "<group>"; };
 		3C2D0481285B242800423D97 /* ScanDiscountViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScanDiscountViewController.h; sourceTree = "<group>"; };
 		3C2D0482285B242800423D97 /* ScanDiscountViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScanDiscountViewController.m; sourceTree = "<group>"; };
+		3C2F437928B748E800F50E0E /* PriceGroupListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PriceGroupListViewController.h; sourceTree = "<group>"; };
+		3C2F437A28B748E800F50E0E /* PriceGroupListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PriceGroupListViewController.m; sourceTree = "<group>"; };
 		3C2F99B6237BE1790000808F /* PortfolioListTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListTableViewCell.m; path = common/Functions/portfolio/PortfolioListTableViewCell.m; sourceTree = SOURCE_ROOT; };
 		3C2F99B7237BE1790000808F /* PortfolioListTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListTableViewCell.h; path = common/Functions/portfolio/PortfolioListTableViewCell.h; sourceTree = SOURCE_ROOT; };
 		3C3A5AFC27D74E4F005F4EFB /* ScanResultViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ScanResultViewController.h; path = common/Functions/camscan/ScanResultViewController.h; sourceTree = SOURCE_ROOT; };
@@ -550,43 +544,11 @@
 		4295AE1A1FE74D46007BE365 /* CommonEditorAutoCompleteView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommonEditorAutoCompleteView.m; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.m; sourceTree = "<group>"; };
 		4295AE1B1FE74D46007BE365 /* CommonEditorAutoCompleteView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CommonEditorAutoCompleteView.xib; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.xib; sourceTree = "<group>"; };
 		42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = status_filter_cadedate_po.json; path = common/Functions/order/status_filter_cadedate_po.json; sourceTree = SOURCE_ROOT; };
-		42BEF3241E89FE1100632AB6 /* FirebaseAnalytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseAnalytics.framework; sourceTree = "<group>"; };
-		42BEF3271E89FE1100632AB6 /* FirebaseCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseCore.framework; sourceTree = "<group>"; };
-		42BEF3291E89FE1100632AB6 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
-		42BEF32B1E89FE1100632AB6 /* FirebaseInstanceID.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseInstanceID.framework; sourceTree = "<group>"; };
-		42BEF32C1E89FE1100632AB6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
-		42BEF32F1E89FE1100632AB6 /* GGLAnalytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GGLAnalytics.framework; sourceTree = "<group>"; };
-		42BEF3301E89FE1100632AB6 /* GGLCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GGLCore.framework; sourceTree = "<group>"; };
-		42BEF3321E89FE1100632AB6 /* Analytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Analytics.h; sourceTree = "<group>"; };
-		42BEF3331E89FE1100632AB6 /* Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Core.h; sourceTree = "<group>"; };
-		42BEF3341E89FE1100632AB6 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
-		42BEF3361E89FE1100632AB6 /* Analytics-Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Analytics-Module.h"; sourceTree = "<group>"; };
-		42BEF3371E89FE1100632AB6 /* Core-Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Core-Module.h"; sourceTree = "<group>"; };
-		42BEF3381E89FE1100632AB6 /* SignIn-Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SignIn-Module.h"; sourceTree = "<group>"; };
-		42BEF3391E89FE1100632AB6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
-		42BEF33C1E89FE1100632AB6 /* libGoogleAnalytics.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libGoogleAnalytics.a; sourceTree = "<group>"; };
-		42BEF33E1E89FE1100632AB6 /* GAI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAI.h; sourceTree = "<group>"; };
-		42BEF33F1E89FE1100632AB6 /* GAIDictionaryBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIDictionaryBuilder.h; sourceTree = "<group>"; };
-		42BEF3401E89FE1100632AB6 /* GAIEcommerceFields.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommerceFields.h; sourceTree = "<group>"; };
-		42BEF3411E89FE1100632AB6 /* GAIEcommerceProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommerceProduct.h; sourceTree = "<group>"; };
-		42BEF3421E89FE1100632AB6 /* GAIEcommerceProductAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommerceProductAction.h; sourceTree = "<group>"; };
-		42BEF3431E89FE1100632AB6 /* GAIEcommercePromotion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIEcommercePromotion.h; sourceTree = "<group>"; };
-		42BEF3441E89FE1100632AB6 /* GAIFields.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAIFields.h; sourceTree = "<group>"; };
-		42BEF3451E89FE1100632AB6 /* GAILogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAILogger.h; sourceTree = "<group>"; };
-		42BEF3461E89FE1100632AB6 /* GAITrackedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAITrackedViewController.h; sourceTree = "<group>"; };
-		42BEF3471E89FE1100632AB6 /* GAITracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GAITracker.h; sourceTree = "<group>"; };
-		42BEF34A1E89FE1100632AB6 /* GTMNSData+zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSData+zlib.h"; sourceTree = "<group>"; };
-		42BEF34B1E89FE1100632AB6 /* GTMNSData+zlib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSData+zlib.m"; sourceTree = "<group>"; };
-		42BEF34C1E89FE1100632AB6 /* GTMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMDefines.h; sourceTree = "<group>"; };
-		42BEF34E1E89FE1100632AB6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
 		42BEF35C1E89FECD00632AB6 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
 		42BEF35E1E89FEE300632AB6 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
-		42BEF3601E8A005800632AB6 /* GoogleAnalyst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoogleAnalyst.h; sourceTree = "<group>"; };
-		42BEF3611E8A005800632AB6 /* GoogleAnalyst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleAnalyst.m; sourceTree = "<group>"; };
 		42BF67CA1E5179970081F90A /* ERPUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ERPUtils.h; path = common/ERPUtils.h; sourceTree = SOURCE_ROOT; };
 		42BF67CB1E5179970081F90A /* ERPUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ERPUtils.m; path = common/ERPUtils.m; sourceTree = SOURCE_ROOT; };
 		42D9A0221EB02DA6008AF7AF /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
-		42D9A0241EB03994008AF7AF /* libAdIdAccess.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libAdIdAccess.a; sourceTree = "<group>"; };
 		42DC12EF1F0CD98E00A4C011 /* OrderDetailPickInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OrderDetailPickInfoCell.h; path = common/Functions/order/OrderDetailPickInfoCell.h; sourceTree = SOURCE_ROOT; };
 		42DC12F01F0CD98E00A4C011 /* OrderDetailPickInfoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OrderDetailPickInfoCell.m; path = common/Functions/order/OrderDetailPickInfoCell.m; sourceTree = SOURCE_ROOT; };
 		42E489601EE63F4E007256A0 /* more_color_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = more_color_64.png; sourceTree = "<group>"; };
@@ -949,27 +911,20 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				42D9A0251EB03994008AF7AF /* libAdIdAccess.a in Frameworks */,
 				42D9A0231EB02DA6008AF7AF /* AdSupport.framework in Frameworks */,
 				42BEF35F1E89FEE300632AB6 /* CoreData.framework in Frameworks */,
 				42BEF35D1E89FECD00632AB6 /* SystemConfiguration.framework in Frameworks */,
 				3CB44F1028733D6D00E24494 /* libScanApiCore.a in Frameworks */,
 				71BBA2291CEAC17E00C91DED /* libz.tbd in Frameworks */,
-				42BEF3551E89FE1200632AB6 /* GGLCore.framework in Frameworks */,
 				718716291C433DA400F25860 /* AVFoundation.framework in Frameworks */,
 				718716271C433D9700F25860 /* AudioToolbox.framework in Frameworks */,
-				42BEF3541E89FE1200632AB6 /* GGLAnalytics.framework in Frameworks */,
-				42BEF3501E89FE1100632AB6 /* FirebaseCore.framework in Frameworks */,
 				718716251C433D8B00F25860 /* ExternalAccessory.framework in Frameworks */,
 				716961B519594E1000B19FB4 /* libsqlite3.dylib in Frameworks */,
-				42BEF3521E89FE1200632AB6 /* FirebaseInstanceID.framework in Frameworks */,
 				71DEE876192DE00E003F645F /* Accelerate.framework in Frameworks */,
 				71DEE874192DE003003F645F /* QuartzCore.framework in Frameworks */,
 				713F76AC1929F4A7006A7305 /* CoreGraphics.framework in Frameworks */,
 				713F76AE1929F4A7006A7305 /* UIKit.framework in Frameworks */,
 				713F76AA1929F4A7006A7305 /* Foundation.framework in Frameworks */,
-				42BEF34F1E89FE1100632AB6 /* FirebaseAnalytics.framework in Frameworks */,
-				42BEF3571E89FE1200632AB6 /* libGoogleAnalytics.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1105,6 +1060,8 @@
 				3CABE01F2861A51E00CF0DC1 /* StockViewController.m */,
 				3CABE0212861A5E000CF0DC1 /* StockTableViewCell.h */,
 				3CABE0222861A5E000CF0DC1 /* StockTableViewCell.m */,
+				3C2F437928B748E800F50E0E /* PriceGroupListViewController.h */,
+				3C2F437A28B748E800F50E0E /* PriceGroupListViewController.m */,
 			);
 			name = OLO;
 			sourceTree = "<group>";
@@ -1194,165 +1151,6 @@
 			name = AutoComplete;
 			sourceTree = "<group>";
 		};
-		42BEF3211E89FE1100632AB6 /* GoogleAnalytics */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3601E8A005800632AB6 /* GoogleAnalyst.h */,
-				42BEF3611E8A005800632AB6 /* GoogleAnalyst.m */,
-				42BEF3221E89FE1100632AB6 /* FirebaseAnalytics */,
-				42BEF3251E89FE1100632AB6 /* FirebaseCore */,
-				42BEF3281E89FE1100632AB6 /* FirebaseInstanceID */,
-				42BEF32D1E89FE1100632AB6 /* Google */,
-				42BEF33A1E89FE1100632AB6 /* GoogleAnalytics */,
-				42BEF3481E89FE1100632AB6 /* GoogleToolboxForMac */,
-			);
-			path = GoogleAnalytics;
-			sourceTree = SOURCE_ROOT;
-		};
-		42BEF3221E89FE1100632AB6 /* FirebaseAnalytics */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3231E89FE1100632AB6 /* Frameworks */,
-			);
-			path = FirebaseAnalytics;
-			sourceTree = "<group>";
-		};
-		42BEF3231E89FE1100632AB6 /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3241E89FE1100632AB6 /* FirebaseAnalytics.framework */,
-			);
-			path = Frameworks;
-			sourceTree = "<group>";
-		};
-		42BEF3251E89FE1100632AB6 /* FirebaseCore */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3261E89FE1100632AB6 /* Frameworks */,
-			);
-			path = FirebaseCore;
-			sourceTree = "<group>";
-		};
-		42BEF3261E89FE1100632AB6 /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3271E89FE1100632AB6 /* FirebaseCore.framework */,
-			);
-			path = Frameworks;
-			sourceTree = "<group>";
-		};
-		42BEF3281E89FE1100632AB6 /* FirebaseInstanceID */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3291E89FE1100632AB6 /* CHANGELOG.md */,
-				42BEF32A1E89FE1100632AB6 /* Frameworks */,
-				42BEF32C1E89FE1100632AB6 /* README.md */,
-			);
-			path = FirebaseInstanceID;
-			sourceTree = "<group>";
-		};
-		42BEF32A1E89FE1100632AB6 /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF32B1E89FE1100632AB6 /* FirebaseInstanceID.framework */,
-			);
-			path = Frameworks;
-			sourceTree = "<group>";
-		};
-		42BEF32D1E89FE1100632AB6 /* Google */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF32E1E89FE1100632AB6 /* Frameworks */,
-				42BEF3311E89FE1100632AB6 /* Headers */,
-				42BEF3391E89FE1100632AB6 /* README.md */,
-			);
-			path = Google;
-			sourceTree = "<group>";
-		};
-		42BEF32E1E89FE1100632AB6 /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF32F1E89FE1100632AB6 /* GGLAnalytics.framework */,
-				42BEF3301E89FE1100632AB6 /* GGLCore.framework */,
-			);
-			path = Frameworks;
-			sourceTree = "<group>";
-		};
-		42BEF3311E89FE1100632AB6 /* Headers */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3321E89FE1100632AB6 /* Analytics.h */,
-				42BEF3331E89FE1100632AB6 /* Core.h */,
-				42BEF3341E89FE1100632AB6 /* module.modulemap */,
-				42BEF3351E89FE1100632AB6 /* ModuleHeaders */,
-			);
-			path = Headers;
-			sourceTree = "<group>";
-		};
-		42BEF3351E89FE1100632AB6 /* ModuleHeaders */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3361E89FE1100632AB6 /* Analytics-Module.h */,
-				42BEF3371E89FE1100632AB6 /* Core-Module.h */,
-				42BEF3381E89FE1100632AB6 /* SignIn-Module.h */,
-			);
-			path = ModuleHeaders;
-			sourceTree = "<group>";
-		};
-		42BEF33A1E89FE1100632AB6 /* GoogleAnalytics */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF33B1E89FE1100632AB6 /* Libraries */,
-				42BEF33D1E89FE1100632AB6 /* Sources */,
-			);
-			path = GoogleAnalytics;
-			sourceTree = "<group>";
-		};
-		42BEF33B1E89FE1100632AB6 /* Libraries */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF33C1E89FE1100632AB6 /* libGoogleAnalytics.a */,
-				42D9A0241EB03994008AF7AF /* libAdIdAccess.a */,
-			);
-			path = Libraries;
-			sourceTree = "<group>";
-		};
-		42BEF33D1E89FE1100632AB6 /* Sources */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF33E1E89FE1100632AB6 /* GAI.h */,
-				42BEF33F1E89FE1100632AB6 /* GAIDictionaryBuilder.h */,
-				42BEF3401E89FE1100632AB6 /* GAIEcommerceFields.h */,
-				42BEF3411E89FE1100632AB6 /* GAIEcommerceProduct.h */,
-				42BEF3421E89FE1100632AB6 /* GAIEcommerceProductAction.h */,
-				42BEF3431E89FE1100632AB6 /* GAIEcommercePromotion.h */,
-				42BEF3441E89FE1100632AB6 /* GAIFields.h */,
-				42BEF3451E89FE1100632AB6 /* GAILogger.h */,
-				42BEF3461E89FE1100632AB6 /* GAITrackedViewController.h */,
-				42BEF3471E89FE1100632AB6 /* GAITracker.h */,
-			);
-			path = Sources;
-			sourceTree = "<group>";
-		};
-		42BEF3481E89FE1100632AB6 /* GoogleToolboxForMac */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF3491E89FE1100632AB6 /* Foundation */,
-				42BEF34C1E89FE1100632AB6 /* GTMDefines.h */,
-				42BEF34E1E89FE1100632AB6 /* README.md */,
-			);
-			path = GoogleToolboxForMac;
-			sourceTree = "<group>";
-		};
-		42BEF3491E89FE1100632AB6 /* Foundation */ = {
-			isa = PBXGroup;
-			children = (
-				42BEF34A1E89FE1100632AB6 /* GTMNSData+zlib.h */,
-				42BEF34B1E89FE1100632AB6 /* GTMNSData+zlib.m */,
-			);
-			path = Foundation;
-			sourceTree = "<group>";
-		};
 		42BEF35B1E89FECC00632AB6 /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
@@ -1709,7 +1507,6 @@
 				71DF74311C5757C800F2789C /* CommonUI */,
 				71C1D84C1F456CAA00CEA1C9 /* HWWeakTimer.h */,
 				71C1D84D1F456CAA00CEA1C9 /* HWWeakTimer.m */,
-				42BEF3211E89FE1100632AB6 /* GoogleAnalytics */,
 				4289809B1E24B526005F1BD8 /* JKTimer */,
 				4289805A1E249375005F1BD8 /* UIColor+HEX */,
 				4289803C1E249339005F1BD8 /* JKLock */,
@@ -2347,7 +2144,6 @@
 				712AFED81DBA050200254965 /* GridDrawable.m in Sources */,
 				424A02D11FFB3A0B0088DC56 /* RABackOrderSubmitAlertController.m in Sources */,
 				7162A5C11C5873BB00AB630E /* FilterCellCadedate.m in Sources */,
-				42BEF3581E89FE1200632AB6 /* GTMNSData+zlib.m in Sources */,
 				3C2F99B8237BE1790000808F /* PortfolioListTableViewCell.m in Sources */,
 				71DF742B1C57560600F2789C /* Reachability.m in Sources */,
 				7162A5701C58728D00AB630E /* DetailHeaderCell.m in Sources */,
@@ -2371,7 +2167,6 @@
 				7162A5E01C5876E300AB630E /* SettingViewController.m in Sources */,
 				712AFEDB1DBA050200254965 /* LineDrawable.m in Sources */,
 				71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */,
-				42BEF3621E8A005800632AB6 /* GoogleAnalyst.m in Sources */,
 				7162A5171C58704600AB630E /* BundleModelViewController.m in Sources */,
 				7162A5411C58719D00AB630E /* RATreeNode.m in Sources */,
 				3C514947273D095900F78617 /* CommonEditorCellSwitch.m in Sources */,
@@ -2453,6 +2248,7 @@
 				7162A5461C58719D00AB630E /* RATreeView+Enums.m in Sources */,
 				7162A54B1C58719D00AB630E /* RAViewController.m in Sources */,
 				71BBA2411CEAEF0700C91DED /* mztools.c in Sources */,
+				3C2F437B28B748E800F50E0E /* PriceGroupListViewController.m in Sources */,
 				7162A59C1C58733400AB630E /* OrderDetailPriceCell.m in Sources */,
 				715850461CF6F0E500856B20 /* DefaultAppearance.m in Sources */,
 				3C7E5A8E237BDB0C006D0105 /* PortfolioListViewController.m in Sources */,
@@ -2717,7 +2513,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 51497;
+				CURRENT_PROJECT_VERSION = 51537;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2729,7 +2525,7 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "HMLG Scan Order/HMLG Scan Order-Prefix.pch";
 				INFOPLIST_FILE = "$(SRCROOT)/HMLG Scan Order/HMLG Scan Order-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 15.0;
 				LIBRARY_SEARCH_PATHS = (
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",
@@ -2761,7 +2557,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 51497;
+				CURRENT_PROJECT_VERSION = 51537;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2773,7 +2569,7 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "HMLG Scan Order/HMLG Scan Order-Prefix.pch";
 				INFOPLIST_FILE = "$(SRCROOT)/HMLG Scan Order/HMLG Scan Order-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 15.0;
 				LIBRARY_SEARCH_PATHS = (
 					"$(PROJECT_DIR)/ScanApiSDK-10.2.227-2/lib",
 					"$(PROJECT_DIR)/GoogleAnalytics/GoogleAnalytics/Libraries",

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>HMLG Scan Order.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>4</integer>
 		</dict>
 	</dict>
 </dict>

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order/Base.lproj/Main.storyboard

@@ -948,7 +948,7 @@
                             </view>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="qfZ-AN-nm6"/>
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                             <constraint firstItem="G66-bZ-5AK" firstAttribute="top" secondItem="qfZ-AN-nm6" secondAttribute="top" id="A0p-mk-G29"/>
                             <constraint firstItem="G66-bZ-5AK" firstAttribute="bottom" secondItem="qfZ-AN-nm6" secondAttribute="bottom" id="R2y-gL-KVz"/>
@@ -2035,7 +2035,7 @@ Email: redantsupport@united-us.net</string>
         <image name="btn_retrieve" width="102" height="30"/>
         <image name="btn_signin" width="100" height="30"/>
         <image name="camera" width="48" height="48"/>
-        <image name="cart_empty" width="96" height="96"/>
+        <image name="cart_empty" width="72" height="72"/>
         <image name="check_1_24" width="24" height="24"/>
         <image name="checkbox" width="16" height="16"/>
         <image name="close" width="40" height="40"/>

+ 133 - 117
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -942,6 +942,7 @@
 }
 -(void) Loginout:(bool)showlogin
 {
+    return;
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
@@ -1331,8 +1332,8 @@
 //        RASingleton.sharedInstance.scan_temp_code
     
     NSString *orderdir =[OLDataProvider getScanPath];
-    appDelegate.order_code = RASingleton.sharedInstance.scan_temp_code;
-    [OLDataProvider moveScanTemp2Order];
+//    appDelegate.order_code = RASingleton.sharedInstance.scan_temp_code;
+//    [OLDataProvider moveScanTemp2Order];
     
 //        NSString *orderdir = [OLDataProvider getScanPath];
     NSString* userdir = [OLDataProvider getUserPath];
@@ -1345,7 +1346,7 @@
     
 
     
-    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
+//    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
 //
 //        int section_count = [self.content_data_download[@"section_count"] intValue];
 //
@@ -1383,7 +1384,7 @@
 //
 //        [RAUtils dicttofile:contactpath dict:appDelegate.customerInfo];
     
-    orderdir = [OLDataProvider getScanOrderPath];
+//    orderdir = [OLDataProvider getScanOrderPath];
     NSString *cartpath = [orderdir stringByAppendingPathComponent:@"cart.json"];
     
     RASingleton.sharedInstance.scan_cart[@"price_type"] = @(RASingleton.sharedInstance.price_type);
@@ -1393,29 +1394,29 @@
     
     
     
-    NSMutableDictionary* orderlist = nil;
-    
-    
-        NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
+    NSMutableDictionary* orderlist = [OLDataProvider getScanOrderList];
     
     
-            if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
- 
-                
-                orderlist = [NSMutableDictionary new];
-                
-//                    [orderlist addObject:appDelegate.order_code];
-//                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-                
-          }
-            else
-            {
-                orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-                
-//                    [orderlist insertObject:appDelegate.order_code atIndex:0];
- 
-//                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-            }
+//        NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
+//
+//
+//            if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
+//
+//
+//                orderlist = [NSMutableDictionary new];
+//
+////                    [orderlist addObject:appDelegate.order_code];
+////                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//
+//          }
+//            else
+//            {
+//                orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+//
+////                    [orderlist insertObject:appDelegate.order_code atIndex:0];
+//
+////                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//            }
     float p =0;
     float s =0;
     int order_qty=0;
@@ -1452,7 +1453,7 @@
     orderitem[@"customer_name"] = appDelegate.customerInfo[@"customer_contact"];
     orderitem[@"purchase_time"] = [RAUtils current_date_time];
         orderitem[@"order_status"] = @"Saved Order";
-    orderitem[@"order_code"] = order_code;
+    orderitem[@"order_code"] = appDelegate.order_code;
     NSMutableDictionary* section =RASingleton.sharedInstance.scan_cart[@"section_0"];
 
 //        orderitem[@"model_count"] =[ NSString stringWithFormat:@"%d",order_qty];//RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] ];
@@ -1476,7 +1477,9 @@
         }
     }
     newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:newlist];
+    
+    [OLDataProvider saveScanOrderList:newlist];
+//    [RAUtils dicttofile:orderlistPath dict:newlist];
 #ifdef RA_NOTIFICATION
     [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
     
@@ -1534,81 +1537,87 @@
                             AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
                             
                            // int cc=[RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] intValue];
-                            if(appDelegate.order_code == nil && [RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] intValue]>0)
+                            bool issaved = [OLDataProvider isSavedScanOrder:appDelegate.order_code];
+                            if(/*appDelegate.order_code == nil*/!issaved && [RASingleton.sharedInstance.scan_cart[@"section_0"][@"count"] intValue]>0)
                             {
                                 UIAlertController *alertController1 = [UIAlertController alertControllerWithTitle:@"Save Cart?" message:@"" preferredStyle:UIAlertControllerStyleAlert];
                                 UIAlertAction *action_1 = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
                                     [self scanTempsave];
-                                    appDelegate.cart_count = 0;//[[jsobj  :@"cart_count"] intValue];
-                                    appDelegate.wish_count =0;//[[jsobj valueForKey:@"wish_count"] intValue];
-                                    appDelegate.port_count =0;//[[jsobj valueForKey:@"portfolio_count"] intValue];
-                                    
-                                    [appDelegate update_count_mark];
-                                    
-                                    
-                                    appDelegate.can_show_price =false;
-                                    appDelegate.can_see_price =false;
-                                    appDelegate.can_create_portfolio =false;
-                                    appDelegate.can_create_order =false;
-                                    
                                     
-                                    appDelegate.can_cancel_order =false;
-                                    appDelegate.can_set_cart_price =false;
-                                    appDelegate.can_delete_order =false;
-                                    appDelegate.can_submit_order =false;
-                                    appDelegate.can_set_tearsheet_price =false;
-                                    appDelegate.can_update_contact_info = false;
-                                    
-                                    appDelegate.save_order_logout = false;
-                                    appDelegate.submit_order_logout = false;
-                                    appDelegate.alert_sold_in_quantities = false;
-                                    
-                                    appDelegate.ipad_perm =nil ;
-                                    appDelegate.user_type = USER_ROLE_UNKNOWN;
-                                    appDelegate.OrderFilter= nil;
-                                    [appDelegate SetSo:nil];
-                                    [appDelegate set_main_button_panel];
+                                    [OLDataProvider scanCloseOrder];
+                                    [appDelegate Logout];
+//                                    appDelegate.cart_count = 0;//[[jsobj  :@"cart_count"] intValue];
+//                                    appDelegate.wish_count =0;//[[jsobj valueForKey:@"wish_count"] intValue];
+//                                    appDelegate.port_count =0;//[[jsobj valueForKey:@"portfolio_count"] intValue];
+//
+//                                    [appDelegate update_count_mark];
+//
+//
+//                                    appDelegate.can_show_price =false;
+//                                    appDelegate.can_see_price =false;
+//                                    appDelegate.can_create_portfolio =false;
+//                                    appDelegate.can_create_order =false;
+//
+//
+//                                    appDelegate.can_cancel_order =false;
+//                                    appDelegate.can_set_cart_price =false;
+//                                    appDelegate.can_delete_order =false;
+//                                    appDelegate.can_submit_order =false;
+//                                    appDelegate.can_set_tearsheet_price =false;
+//                                    appDelegate.can_update_contact_info = false;
+//
+//                                    appDelegate.save_order_logout = false;
+//                                    appDelegate.submit_order_logout = false;
+//                                    appDelegate.alert_sold_in_quantities = false;
+//
+//                                    appDelegate.ipad_perm =nil ;
+//                                    appDelegate.user_type = USER_ROLE_UNKNOWN;
+//                                    appDelegate.OrderFilter= nil;
+//                                    [appDelegate SetSo:nil];
+//                                    [appDelegate set_main_button_panel];
                         #ifdef RA_NOTIFICATION
                                     [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
                         #endif
-                                    [appDelegate Logout];
+//                                    [appDelegate Logout];
                                 }];
                                 UIAlertAction *action_2 = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                                     //create new;
-               
-                                    appDelegate.cart_count = 0;//[[jsobj  :@"cart_count"] intValue];
-                                    appDelegate.wish_count =0;//[[jsobj valueForKey:@"wish_count"] intValue];
-                                    appDelegate.port_count =0;//[[jsobj valueForKey:@"portfolio_count"] intValue];
-                                    
-                                    [appDelegate update_count_mark];
-                                    
-                                    
-                                    appDelegate.can_show_price =false;
-                                    appDelegate.can_see_price =false;
-                                    appDelegate.can_create_portfolio =false;
-                                    appDelegate.can_create_order =false;
-                                    
-                                    
-                                    appDelegate.can_cancel_order =false;
-                                    appDelegate.can_set_cart_price =false;
-                                    appDelegate.can_delete_order =false;
-                                    appDelegate.can_submit_order =false;
-                                    appDelegate.can_set_tearsheet_price =false;
-                                    appDelegate.can_update_contact_info = false;
-                                    
-                                    appDelegate.save_order_logout = false;
-                                    appDelegate.submit_order_logout = false;
-                                    appDelegate.alert_sold_in_quantities = false;
-                                    
-                                    appDelegate.ipad_perm =nil ;
-                                    appDelegate.user_type = USER_ROLE_UNKNOWN;
-                                    appDelegate.OrderFilter= nil;
-                                    [appDelegate SetSo:nil];
-                                    [appDelegate set_main_button_panel];
+                                    [OLDataProvider scanCloseOrder];
+                                    [appDelegate Logout];
+
+//                                    appDelegate.cart_count = 0;//[[jsobj  :@"cart_count"] intValue];
+//                                    appDelegate.wish_count =0;//[[jsobj valueForKey:@"wish_count"] intValue];
+//                                    appDelegate.port_count =0;//[[jsobj valueForKey:@"portfolio_count"] intValue];
+//
+//                                    [appDelegate update_count_mark];
+//
+//
+//                                    appDelegate.can_show_price =false;
+//                                    appDelegate.can_see_price =false;
+//                                    appDelegate.can_create_portfolio =false;
+//                                    appDelegate.can_create_order =false;
+//
+//
+//                                    appDelegate.can_cancel_order =false;
+//                                    appDelegate.can_set_cart_price =false;
+//                                    appDelegate.can_delete_order =false;
+//                                    appDelegate.can_submit_order =false;
+//                                    appDelegate.can_set_tearsheet_price =false;
+//                                    appDelegate.can_update_contact_info = false;
+//
+//                                    appDelegate.save_order_logout = false;
+//                                    appDelegate.submit_order_logout = false;
+//                                    appDelegate.alert_sold_in_quantities = false;
+//
+//                                    appDelegate.ipad_perm =nil ;
+//                                    appDelegate.user_type = USER_ROLE_UNKNOWN;
+//                                    appDelegate.OrderFilter= nil;
+//                                    [appDelegate SetSo:nil];
+//                                    [appDelegate set_main_button_panel];
                         #ifdef RA_NOTIFICATION
                                     [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
                         #endif
-                                    [appDelegate Logout];
+//                                    [appDelegate Logout];
                
                                 }];
                                 [alertController1 addAction:action_1];
@@ -1620,41 +1629,46 @@
                                 
                                 return;
                             }
+                            [OLDataProvider scanCloseOrder];
+                            [appDelegate Logout];
                             
+//                            appDelegate.cart_count = 0;//[[jsobj  :@"cart_count"] intValue];
+//                            appDelegate.wish_count =0;//[[jsobj valueForKey:@"wish_count"] intValue];
+//                            appDelegate.port_count =0;//[[jsobj valueForKey:@"portfolio_count"] intValue];
+//
+//                            [appDelegate update_count_mark];
+//
+//
+//                            appDelegate.can_show_price =false;
+//                            appDelegate.can_see_price =false;
+//                            appDelegate.can_create_portfolio =false;
+//                            appDelegate.can_create_order =false;
+//
+//
+//                            appDelegate.can_cancel_order =false;
+//                            appDelegate.can_set_cart_price =false;
+//                            appDelegate.can_delete_order =false;
+//                            appDelegate.can_submit_order =false;
+//                            appDelegate.can_set_tearsheet_price =false;
+//                            appDelegate.can_update_contact_info = false;
+//
+//                            appDelegate.save_order_logout = false;
+//                            appDelegate.submit_order_logout = false;
+//                            appDelegate.alert_sold_in_quantities = false;
+//
+//                            appDelegate.ipad_perm =nil ;
+//                            appDelegate.user_type = USER_ROLE_UNKNOWN;
+//                            appDelegate.OrderFilter= nil;
+//                            [appDelegate SetSo:nil];
+//
                             
-                            appDelegate.cart_count = 0;//[[jsobj  :@"cart_count"] intValue];
-                            appDelegate.wish_count =0;//[[jsobj valueForKey:@"wish_count"] intValue];
-                            appDelegate.port_count =0;//[[jsobj valueForKey:@"portfolio_count"] intValue];
-                            
-                            [appDelegate update_count_mark];
-                            
-                            
-                            appDelegate.can_show_price =false;
-                            appDelegate.can_see_price =false;
-                            appDelegate.can_create_portfolio =false;
-                            appDelegate.can_create_order =false;
-                            
-                            
-                            appDelegate.can_cancel_order =false;
-                            appDelegate.can_set_cart_price =false;
-                            appDelegate.can_delete_order =false;
-                            appDelegate.can_submit_order =false;
-                            appDelegate.can_set_tearsheet_price =false;
-                            appDelegate.can_update_contact_info = false;
                             
-                            appDelegate.save_order_logout = false;
-                            appDelegate.submit_order_logout = false;
-                            appDelegate.alert_sold_in_quantities = false;
                             
-                            appDelegate.ipad_perm =nil ;
-                            appDelegate.user_type = USER_ROLE_UNKNOWN;
-                            appDelegate.OrderFilter= nil;
-                            [appDelegate SetSo:nil];
-                            [appDelegate set_main_button_panel];
+//                            [appDelegate set_main_button_panel];
                 #ifdef RA_NOTIFICATION
                             [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
                 #endif
-                            [appDelegate Logout];
+//                            [appDelegate Logout];
                         }];
                          UIAlertAction *action_2 = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                              //create new;
@@ -3134,7 +3148,7 @@
 //    RASingleton.sharedInstance.permissions_edit_order = true;
     
     RASingleton.sharedInstance.price_type = 1;
-    [OLDataProvider createScanTempFolder];
+//    [OLDataProvider createScanTempFolder];
     
     NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"] ;
     if (addressDic) {
@@ -3174,6 +3188,8 @@
         };
         [self.navigationController pushViewController:servervc animated:true];
     }
+    
+    [RADataProvider default_price_group];
 }
 
 //-(void) newoloorder

+ 18 - 0
RedAnt ERP Mobile/HMLG Scan Order/PriceGroupListViewController.h

@@ -0,0 +1,18 @@
+//
+//  PriceGroupListViewController.h
+//  HMLG Scan Order
+//
+//  Created by Rui Zhang on 8/25/22.
+//  Copyright © 2022 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PriceGroupListViewController : UIViewController
+@property (strong, nonatomic) NSArray* pricelist;
+@property (nonatomic , copy) void (^returnValue)(int index);
+@end
+
+NS_ASSUME_NONNULL_END

+ 84 - 0
RedAnt ERP Mobile/HMLG Scan Order/PriceGroupListViewController.m

@@ -0,0 +1,84 @@
+//
+//  PriceGroupListViewController.m
+//  HMLG Scan Order
+//
+//  Created by Rui Zhang on 8/25/22.
+//  Copyright © 2022 United Software Applications, Inc. All rights reserved.
+//
+
+#import "PriceGroupListViewController.h"
+
+@interface PriceGroupListViewController ()
+
+@end
+
+@implementation PriceGroupListViewController
+//
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    [[self navigationController] setNavigationBarHidden:false animated:NO];
+UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                                style:UIBarButtonItemStylePlain
+                                                               target:self
+                                                               action:@selector( onBackClick:)];
+//    self.navigationController.navigationItem.leftBarButtonItem=closeButton;
+self.navigationItem.leftBarButtonItem = closeButton;
+}
+- (void)onBackClick:(UIButton *)sender {
+    
+    
+    [self.navigationController popViewControllerAnimated:FALSE];
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    
+    return self.pricelist.count;
+    
+    
+
+}
+//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+//    return 136.0f;
+//}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    static NSString *MyIdentifier = @"Cell";
+    
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
+    
+    if (cell == nil)
+    {
+        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
+                                      reuseIdentifier:MyIdentifier];
+
+    }
+    
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    cell.textLabel.text = self.pricelist[indexPath.row];
+    
+    return cell;
+}
+
+- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    
+    if(self.returnValue)
+        self.returnValue(indexPath.item);
+    
+    [[self navigationController]popViewControllerAnimated:true];
+    
+//    [self dismissViewControllerAnimated:TRUE completion:nil];
+    
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 57 - 4
RedAnt ERP Mobile/HMLG Scan Order/SO.storyboard

@@ -2,7 +2,6 @@
 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="ipad7_9" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
-        <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
@@ -2000,6 +1999,15 @@ Stock</string>
                                         <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                         <nil key="highlightedColor"/>
                                     </label>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cPY-vO-WZ0">
+                                        <rect key="frame" x="15" y="46" width="149" height="30"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                        <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                        <state key="normal" title="Bulk Update Discount"/>
+                                        <connections>
+                                            <action selector="onBulkDiscount:" destination="oRS-pB-8jo" eventType="touchUpInside" id="dcf-oc-bXG"/>
+                                        </connections>
+                                    </button>
                                 </subviews>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
@@ -2008,6 +2016,7 @@ Stock</string>
                                     <constraint firstItem="3hY-G2-bAt" firstAttribute="leading" secondItem="g1j-nr-vEW" secondAttribute="trailing" constant="20" id="1Fc-Xk-22e"/>
                                     <constraint firstItem="Prh-BQ-CkY" firstAttribute="leading" secondItem="MkS-tT-MEd" secondAttribute="trailing" constant="20" id="2Ei-HL-QLf"/>
                                     <constraint firstAttribute="bottom" secondItem="EcM-RL-hry" secondAttribute="bottom" constant="10" id="2Z3-SC-CW7"/>
+                                    <constraint firstItem="cPY-vO-WZ0" firstAttribute="top" secondItem="Fkc-Lk-5jB" secondAttribute="bottom" constant="6" id="39l-Lx-DdN"/>
                                     <constraint firstItem="Dx2-do-qf9" firstAttribute="trailing" secondItem="eiF-G7-95R" secondAttribute="trailing" id="6Um-xe-vpu"/>
                                     <constraint firstItem="sS1-r0-cLw" firstAttribute="centerY" secondItem="DdS-4S-1zx" secondAttribute="centerY" id="7tL-kh-m4G"/>
                                     <constraint firstItem="Dx2-do-qf9" firstAttribute="leading" secondItem="y4m-c1-DFh" secondAttribute="trailing" constant="8" id="7zD-OG-qN5"/>
@@ -2047,6 +2056,7 @@ Stock</string>
                                     <constraint firstItem="DcE-qL-jJq" firstAttribute="trailing" secondItem="8gM-ne-ChU" secondAttribute="trailing" id="nPe-ck-WmZ"/>
                                     <constraint firstItem="jbJ-5K-Qgr" firstAttribute="leading" secondItem="EcM-RL-hry" secondAttribute="trailing" id="o2n-hY-mEQ"/>
                                     <constraint firstItem="0i6-zY-RD3" firstAttribute="centerY" secondItem="ubF-HT-6Rg" secondAttribute="centerY" id="odm-FA-KLw"/>
+                                    <constraint firstItem="EcM-RL-hry" firstAttribute="leading" secondItem="cPY-vO-WZ0" secondAttribute="leading" id="rsP-6m-uiG"/>
                                     <constraint firstItem="y4m-c1-DFh" firstAttribute="top" secondItem="pfb-lq-2lh" secondAttribute="bottom" constant="4" id="vMz-bA-3MY"/>
                                     <constraint firstItem="DcE-qL-jJq" firstAttribute="centerY" secondItem="UVG-on-4aI" secondAttribute="centerY" id="w9o-01-z1E"/>
                                     <constraint firstItem="DdS-4S-1zx" firstAttribute="centerY" secondItem="ubF-HT-6Rg" secondAttribute="centerY" id="xuh-fD-gA1"/>
@@ -2072,6 +2082,7 @@ Stock</string>
                         </constraints>
                     </view>
                     <connections>
+                        <outlet property="btnBulkDiscount" destination="cPY-vO-WZ0" id="dTl-Ta-8AA"/>
                         <outlet property="btnPrice" destination="0i6-zY-RD3" id="ecM-tU-WKg"/>
                         <outlet property="btn_addwish" destination="kpx-Gm-qig" id="Ot0-Qi-7Hn"/>
                         <outlet property="btn_delete" destination="XVs-gw-r3X" id="xv7-gz-evt"/>
@@ -2570,7 +2581,7 @@ Stock</string>
                                 <rect key="frame" x="0.0" y="0.0" width="744" height="1133"/>
                             </imageView>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c9q-te-KHg">
-                                <rect key="frame" x="182" y="803" width="380" height="260"/>
+                                <rect key="frame" x="182" y="436.5" width="380" height="260"/>
                                 <subviews>
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Homelegance Warehouse Location:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Vv-Np-lYi">
                                         <rect key="frame" x="24" y="16" width="332" height="24"/>
@@ -2618,8 +2629,8 @@ Stock</string>
                                 </subviews>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                 <constraints>
+                                    <constraint firstItem="5Vv-Np-lYi" firstAttribute="top" secondItem="c9q-te-KHg" secondAttribute="top" constant="16" id="ARj-my-hwI"/>
                                     <constraint firstItem="cO1-GO-FNL" firstAttribute="top" secondItem="AcX-Su-5k5" secondAttribute="bottom" constant="16" id="Oh4-1c-KcK"/>
-                                    <constraint firstItem="5Vv-Np-lYi" firstAttribute="top" secondItem="c9q-te-KHg" secondAttribute="top" constant="16" id="QwH-LE-9Zg"/>
                                     <constraint firstItem="5Vv-Np-lYi" firstAttribute="centerX" secondItem="c9q-te-KHg" secondAttribute="centerX" id="R1y-Bw-fin"/>
                                     <constraint firstItem="AcX-Su-5k5" firstAttribute="width" secondItem="5Vv-Np-lYi" secondAttribute="width" id="SC5-oR-IPR"/>
                                     <constraint firstItem="cO1-GO-FNL" firstAttribute="trailing" secondItem="AcX-Su-5k5" secondAttribute="trailing" id="SXM-gU-yBR"/>
@@ -2639,9 +2650,9 @@ Stock</string>
                         <viewLayoutGuide key="safeArea" id="XV0-bs-Lf0"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
-                            <constraint firstItem="XV0-bs-Lf0" firstAttribute="bottom" secondItem="c9q-te-KHg" secondAttribute="bottom" constant="50" id="5mX-I5-a3K"/>
                             <constraint firstItem="c9q-te-KHg" firstAttribute="centerX" secondItem="uQc-Lh-Rs6" secondAttribute="centerX" id="5py-rA-UQR"/>
                             <constraint firstItem="Fch-tn-bXo" firstAttribute="top" secondItem="uQc-Lh-Rs6" secondAttribute="top" id="SfD-fe-Ur7"/>
+                            <constraint firstItem="c9q-te-KHg" firstAttribute="centerY" secondItem="uQc-Lh-Rs6" secondAttribute="centerY" id="dWN-tt-I2P"/>
                             <constraint firstItem="Fch-tn-bXo" firstAttribute="leading" secondItem="XV0-bs-Lf0" secondAttribute="leading" id="ecu-14-4j6"/>
                             <constraint firstAttribute="bottom" secondItem="Fch-tn-bXo" secondAttribute="bottom" id="rSE-qk-tFf"/>
                             <constraint firstAttribute="trailing" secondItem="Fch-tn-bXo" secondAttribute="trailing" id="xc6-v5-vy7"/>
@@ -2698,6 +2709,48 @@ Stock</string>
             </objects>
             <point key="canvasLocation" x="-2868" y="716"/>
         </scene>
+        <!--Price Group List View Controller-->
+        <scene sceneID="Oum-wJ-fMD">
+            <objects>
+                <viewController storyboardIdentifier="PriceGroupListViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Q9h-sX-dBy" customClass="PriceGroupListViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="heg-1s-u69">
+                        <rect key="frame" x="0.0" y="0.0" width="744" height="1133"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="P62-AP-fR0">
+                                <rect key="frame" x="0.0" y="74" width="744" height="1039"/>
+                                <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                <prototypes>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="k1t-dv-O2g">
+                                        <rect key="frame" x="0.0" y="44.5" width="744" height="43.5"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="k1t-dv-O2g" id="JR5-7G-JCb">
+                                            <rect key="frame" x="0.0" y="0.0" width="744" height="43.5"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="Q9h-sX-dBy" id="sHN-iW-vry"/>
+                                    <outlet property="delegate" destination="Q9h-sX-dBy" id="5qJ-6f-qy0"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <viewLayoutGuide key="safeArea" id="1zl-lL-LWR"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <constraints>
+                            <constraint firstItem="P62-AP-fR0" firstAttribute="leading" secondItem="1zl-lL-LWR" secondAttribute="leading" id="0Wy-zY-psD"/>
+                            <constraint firstItem="1zl-lL-LWR" firstAttribute="trailing" secondItem="P62-AP-fR0" secondAttribute="trailing" id="R51-2a-S9F"/>
+                            <constraint firstItem="1zl-lL-LWR" firstAttribute="bottom" secondItem="P62-AP-fR0" secondAttribute="bottom" id="jcD-Db-jtl"/>
+                            <constraint firstItem="P62-AP-fR0" firstAttribute="top" secondItem="1zl-lL-LWR" secondAttribute="top" id="vX1-Ms-DjO"/>
+                        </constraints>
+                    </view>
+                    <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="2SL-GM-xSC" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-3698" y="716"/>
+        </scene>
     </scenes>
     <resources>
         <image name="btn_cancelorder" width="30" height="30"/>

+ 1 - 0
RedAnt ERP Mobile/HMLG Scan Order/ScanDiscountViewController.h

@@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (weak, nonatomic) IBOutlet UIButton *btn10;
 
 @property (nonatomic , copy) void (^onSetValue)(double price,double discount);
+@property bool bulk;
 @end
 
 NS_ASSUME_NONNULL_END

+ 4 - 1
RedAnt ERP Mobile/HMLG Scan Order/ScanDiscountViewController.m

@@ -17,7 +17,10 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
-    
+    if(self.bulk)
+    {
+        
+    }
     // Do any additional setup after loading the view.
 }
 

+ 51 - 25
RedAnt ERP Mobile/HMLG Scan Order/ScanListCell.m

@@ -13,6 +13,7 @@
 #import "RAConvertor.h"
 #import "RAUtils.h"
 #import "AppDelegate.h"
+#import "RADataProvider.h"
 
 @implementation ScanListCell
 
@@ -57,6 +58,8 @@
     if(stockUom==0)
         stockUom=1;
         bool newitem = true;
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
         for(int i=0;i<count;i++)
         {
             
@@ -88,16 +91,16 @@
             
             NSString * unit_price;
             if(RASingleton.sharedInstance.price_type==0)
-                unit_price=_modelJson[@"price0"];
+                unit_price=_modelJson[price_group[@"price_0"][@"name"]];
             else if(_modelJson [@"special_price"])
             {
-                unit_price= _modelJson[@"price2"];
+                unit_price= _modelJson[price_group[@"price_2"][@"name"]];
             }
             else if(_modelJson [@"net_price"])
-                unit_price=_modelJson[@"price3"];
+                unit_price=_modelJson[price_group[@"price_3"][@"name"]];
             else
             {
-                unit_price= _modelJson[@"price1"];
+                unit_price= _modelJson[price_group[@"price_1"][@"name"]];
             }
 
             if([unit_price isEqualToString:@"N/A"])
@@ -146,12 +149,23 @@
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
-    self.labelPrice0.text = appDelegate.price0_name;
-    self.labelPrice1.text = appDelegate.price1_name;
-    self.labelPrice2.text = appDelegate.price2_name;
-    self.labelPrice3.text = appDelegate.price3_name;
-    
+//    self.labelPrice0.text = appDelegate.price0_name;
+//    self.labelPrice1.text = appDelegate.price1_name;
+//    self.labelPrice2.text = appDelegate.price2_name;
+//    self.labelPrice3.text = appDelegate.price3_name;
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
+    self.labelPrice0.text = price_group[@"price_0"][@"display"];//appDelegate.price0_name;
+    self.labelPrice1.text = price_group[@"price_1"][@"display"];//appDelegate.price1_name;
+    self.labelPrice2.text = price_group[@"price_2"][@"display"];//appDelegate.price2_name;
+    self.labelPrice3.text = price_group[@"price_3"][@"display"];//appDelegate.price3_name;
 
+    if(price_group[@"price_4"])
+    {
+        self.labelPrice3.text = price_group[@"price_4"][@"display"];
+    }
+    
+    
+    
     NSLog( [RAConvertor dict2string:modelJson]);
     
     NSString * port=_modelJson[@"port"];
@@ -171,25 +185,25 @@
     _labelCuft.text=_modelJson[@"unit_cuft"];
     _labelOrigin.text=origin;
     _labelPort.text=port;
-    NSString* price0=_modelJson[@"price0"]; //DDP
-    NSString* price1=_modelJson[@"price1"]; //WHSE
-    NSString* price2=_modelJson[@"price2"]; //SHOW
-    NSString* price3=_modelJson[@"price3"]; //%25
+    NSString* price0=_modelJson[price_group[@"price_0"][@"name"]]; //DDP
+    NSString* price1=_modelJson[price_group[@"price_1"][@"name"]]; //WHSE
+    NSString* price2=_modelJson[price_group[@"price_2"][@"name"]]; //SHOW
+    NSString* price3=_modelJson[price_group[@"price_3"][@"name"]]; //NET
  
     
     
     if(![price0 isEqualToString: @"N/A"])
-        price0 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price0"] doubleValue]];
+        price0 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_0"][@"name"]] doubleValue]];
     if(![price1 isEqualToString: @"N/A"])
-        price1 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price1"] doubleValue]];
+        price1 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_1"][@"name"]] doubleValue]];
     if(![price2 isEqualToString: @"N/A"])
     {
-        price2 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price2"] doubleValue]];
+        price2 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_2"][@"name"]] doubleValue]];
 //        if(RASingleton.sharedInstance.price_type==1)
             _modelJson [@"special_price"] = @true;
     }
     if(![price3 isEqualToString: @"N/A"])
-        price3 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price3"] doubleValue]];
+        price3 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_3"][@"name"]] doubleValue]];
 
 //    if(![_modelJson [@"special_price"] boolValue]&& ![price1 isEqualToString: @"N/A"] && [price1 isEqual:price3])
     if((![price1 isEqualToString: @"N/A"] && [price1 isEqual:price3])||(![price2 isEqualToString: @"N/A"] && [price2 isEqual:price3]))
@@ -227,10 +241,10 @@
     
     if([_modelJson [@"special_price"] boolValue])
     {
-        if([_modelJson[@"price2"] isEqualToString:@"N/A"])
+        if([_modelJson[price_group[@"price_2"][@"name"]] isEqualToString:@"N/A"])
             _labelPriceSpecial.text=@"";//_modelJson[@"price2"];
         else
-            _labelPriceSpecial.text=[RAConvertor currencyNumber:[_modelJson[@"price2"] floatValue]];
+            _labelPriceSpecial.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_2"][@"name"]] floatValue]];
     }
     else
     {
@@ -251,14 +265,14 @@
 ////            _labelPriceNCA.text=@"N/A";
 //        }
         
-        if([_modelJson[@"price3"] isEqualToString:@"N/A"])
+        if([_modelJson[price_group[@"price_3"][@"name"]] isEqualToString:@"N/A"])
         {
             _labelPriceNet.text=@"";//_modelJson[@"price3"];
 //            _labelPriceNCA.text=@"N/A";
         }
         else
         {
-            _labelPriceNet.text=[RAConvertor currencyNumber:[_modelJson[@"price3"] floatValue]];
+            _labelPriceNet.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_3"][@"name"]] floatValue]];
 //            _labelPriceNCA.text=@"N/A";
         }
         
@@ -268,15 +282,27 @@
         _labelPriceNet.text=@"";//@"N/A";
     }
     
+    if(price_group[@"price_4"])
+    {
+        // price4 如果存在,会显示在price3的位置
+        NSString* price4=_modelJson[price_group[@"price_4"][@"name"]]; //%25
+        
+        if(![price4 isEqualToString: @"N/A"])
+            price4 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_4"][@"name"]] doubleValue]];
+        else
+            price4 =@"";
+        _labelPriceNet.text=price4;
+    }
+    
     {
-        if([_modelJson[@"price1"] isEqualToString:@"N/A"])
+        if([_modelJson[price_group[@"price_1"][@"name"]] isEqualToString:@"N/A"])
         {
             _labelPriceNCA.text=@"";//_modelJson[@"price1"];
 //            _labelPriceNCA.text=@"N/A";
         }
         else
         {
-            _labelPriceNCA.text=[RAConvertor currencyNumber:[_modelJson[@"price1"] floatValue]];
+            _labelPriceNCA.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_1"][@"name"]] floatValue]];
 //            _labelPriceNet.text=@"N/A";
         }
     }
@@ -301,7 +327,7 @@
     if(RASingleton.sharedInstance.price_type==1)
     {
 //        if(_modelJson [@"net_price"])
-            cell_price=_modelJson[@"price3"];
+            cell_price=_modelJson[price_group[@"price_3"][@"name"]];
 //        else if(_modelJson [@"special_price"])
 //        {
 //            unit_price= _modelJson[@"price2"];
@@ -313,7 +339,7 @@
     }
     else
     {
-        cell_price=_modelJson[@"price0"];
+        cell_price=_modelJson[price_group[@"price_0"][@"name"]];
     }
     
     

+ 44 - 20
RedAnt ERP Mobile/HMLG Scan Order/ScanModelListCell.m

@@ -12,6 +12,7 @@
 #import "RAUtils.h"
 #import "RASingleton.h"
 #import "AppDelegate.h"
+#import "RADataProvider.h"
 
 
 #define NUMBERS @"0123456789\n"
@@ -37,12 +38,17 @@
 - (void)setModelJson:(NSMutableDictionary *)modelJson
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
+    self.labelPrice0.text = price_group[@"price_0"][@"display"];//appDelegate.price0_name;
+    self.labelPrice1.text = price_group[@"price_1"][@"display"];//appDelegate.price1_name;
+    self.labelPrice2.text = price_group[@"price_2"][@"display"];//appDelegate.price2_name;
+    self.labelPrice3.text = price_group[@"price_3"][@"display"];//appDelegate.price3_name;
     
-    self.labelPrice0.text = appDelegate.price0_name;
-    self.labelPrice1.text = appDelegate.price1_name;
-    self.labelPrice2.text = appDelegate.price2_name;
-    self.labelPrice3.text = appDelegate.price3_name;
     
+    if(price_group[@"price_4"])
+    {
+        self.labelPrice3.text = price_group[@"price_4"][@"display"];
+    }
     
     _modelJson = modelJson;
 
@@ -79,25 +85,31 @@
 //    }
     
     
-    NSString* price0=_modelJson[@"price0"]; //DDP
-    NSString* price1=_modelJson[@"price1"]; //WHSE
-    NSString* price2=_modelJson[@"price2"]; //SHOW
-    NSString* price3=_modelJson[@"price3"]; //%25
+//    NSString* price0=_modelJson[@"price0"]; //DDP
+//    NSString* price1=_modelJson[@"price1"]; //WHSE
+//    NSString* price2=_modelJson[@"price2"]; //SHOW
+//    NSString* price3=_modelJson[@"price3"]; //%25
+    NSString* price0=_modelJson[price_group[@"price_0"][@"name"]]; //DDP
+    NSString* price1=_modelJson[price_group[@"price_1"][@"name"]]; //WHSE
+    NSString* price2=_modelJson[price_group[@"price_2"][@"name"]]; //SHOW
+    NSString* price3=_modelJson[price_group[@"price_3"][@"name"]]; //%25
  
     
     
+    
+    
     if(![price0 isEqualToString: @"N/A"])
-        price0 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price0"] doubleValue]];
+        price0 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_0"][@"name"]] doubleValue]];
     if(![price1 isEqualToString: @"N/A"])
-        price1 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price1"] doubleValue]];
+        price1 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_1"][@"name"]] doubleValue]];
     if(![price2 isEqualToString: @"N/A"])
     {
-        price2 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price2"] doubleValue]];
+        price2 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_2"][@"name"]] doubleValue]];
 //        if(RASingleton.sharedInstance.price_type==1)
             _modelJson [@"special_price"] = @true;
     }
     if(![price3 isEqualToString: @"N/A"])
-        price3 = [NSString stringWithFormat:@"%.2f",[_modelJson[@"price3"] doubleValue]];
+        price3 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_3"][@"name"]] doubleValue]];
 
 //    if(![_modelJson [@"special_price"] boolValue]&& ![price1 isEqualToString: @"N/A"] && [price1 isEqual:price3])
     if((![price1 isEqualToString: @"N/A"] && [price1 isEqual:price3])||(![price2 isEqualToString: @"N/A"] && [price2 isEqual:price3]))
@@ -108,10 +120,10 @@
     
     
     
-    if([_modelJson[@"price0"] isEqualToString:@"N/A"])
+    if([_modelJson[price_group[@"price_0"][@"name"]] isEqualToString:@"N/A"])
         _labelPriceCTNR.text=@"";//_modelJson[@"price0"];
     else
-        _labelPriceCTNR.text=[RAConvertor currencyNumber:[_modelJson[@"price0"] floatValue]];
+        _labelPriceCTNR.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_0"][@"name"]] floatValue]];
     
 //    if([price3 isEqualToString:@"N/A"])
 //        _labelPriceNCA.text= price3;
@@ -120,10 +132,10 @@
     
     if([_modelJson [@"special_price"] boolValue])
     {
-        if([_modelJson[@"price2"] isEqualToString:@"N/A"])
+        if([_modelJson[price_group[@"price_2"][@"name"]] isEqualToString:@"N/A"])
             _labelPriceSpecial.text=@"";//_modelJson[@"price2"];
         else
-            _labelPriceSpecial.text=[RAConvertor currencyNumber:[_modelJson[@"price2"] floatValue]];
+            _labelPriceSpecial.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_2"][@"name"]] floatValue]];
     }
     else
     {
@@ -144,14 +156,14 @@
 ////            _labelPriceNCA.text=@"N/A";
 //        }
         
-        if([_modelJson[@"price3"] isEqualToString:@"N/A"])
+        if([_modelJson[price_group[@"price_3"][@"name"]] isEqualToString:@"N/A"])
         {
             _labelPriceNet.text=@"";//_modelJson[@"price3"];
 //            _labelPriceNCA.text=@"N/A";
         }
         else
         {
-            _labelPriceNet.text=[RAConvertor currencyNumber:[_modelJson[@"price3"] floatValue]];
+            _labelPriceNet.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_3"][@"name"]] floatValue]];
 //            _labelPriceNCA.text=@"N/A";
         }
         
@@ -161,6 +173,18 @@
         _labelPriceNet.text=@"";//@"N/A";
     }
         
+    
+    if(price_group[@"price_4"])
+    {
+        // price4 如果存在,会显示在price3的位置
+        NSString* price4=_modelJson[price_group[@"price_4"][@"name"]]; //%25
+        
+        if(![price4 isEqualToString: @"N/A"])
+            price4 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_4"][@"name"]] doubleValue]];
+        else
+            price4 =@"";
+        _labelPriceNet.text=price4;
+    }
 
 //    {
 //        if([_modelJson[@"price1"] isEqualToString:@"N/A"])
@@ -175,14 +199,14 @@
 //        }
 //    }
     {
-        if([_modelJson[@"price1"] isEqualToString:@"N/A"])
+        if([_modelJson[price_group[@"price_1"][@"name"]] isEqualToString:@"N/A"])
         {
             _labelPriceNCA.text=@"";//_modelJson[@"price1"];
 //            _labelPriceNCA.text=@"N/A";
         }
         else
         {
-            _labelPriceNCA.text=[RAConvertor currencyNumber:[_modelJson[@"price1"] floatValue]];
+            _labelPriceNCA.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_1"][@"name"]] floatValue]];
 //            _labelPriceNet.text=@"N/A";
         }
     }

+ 2 - 0
RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.h

@@ -22,5 +22,7 @@ static NSString *kScanAddress = @"ScanAddress";
 @property (strong, nonatomic) IBOutlet UITextField *retryCountBox;
 @property (strong, nonatomic) IBOutlet UITextField *retryTimeIntervalBox;
 @property (weak, nonatomic) IBOutlet UILabel *labelUpdate;
+@property (weak, nonatomic) IBOutlet UILabel *labelPriceGroup;
+@property (weak, nonatomic) IBOutlet UIButton *btnSetPriceGroup;
 
 @end

+ 59 - 1
RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m

@@ -20,6 +20,7 @@
 #import "MainViewController.h"
 #import "ChangePasswordViewController.h"
 #import "SetupServerViewController.h"
+#import "PriceGroupListViewController.h"
 
 @interface ServerSettingViewController ()<UITextFieldDelegate>
 
@@ -92,7 +93,25 @@
 
     [self.navigationController pushViewController:ViewController animated:YES];
 }
-
+-(void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+  
+//        if(appDelegate.price_group.length>0)
+        self.labelPriceGroup.text =appDelegate.price_group;
+//    else
+//    {
+//        [RADataProvider default_price_group];
+//        self.labelPriceGroup.text =appDelegate.price_group;
+//        
+//    }
+    if(appDelegate.user==nil)
+        self.btnSetPriceGroup.hidden =true;
+    else
+        self.btnSetPriceGroup.hidden =false;
+}
 - (void)viewDidLoad {
     [super viewDidLoad];
     
@@ -132,6 +151,12 @@
     
     
     [self loadTemplate];
+    
+    
+    
+    
+
+        
 }
 
 
@@ -241,6 +266,10 @@
     
     if(self.internalText.length>0)
     {
+        
+        [RADataProvider updateTemplate:self];
+        return;
+        
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
         NSString *documents = [paths objectAtIndex:0];
@@ -319,6 +348,7 @@
                                     [self setUserDefaultsValue:templateDic forKey:@"ScanTemplate"];
                                     [self loadTemplate];
                                     [RADataProvider load_scan_models];
+                                    [RADataProvider default_price_group];
                                     
                                 }
                                 //[zip UnzipCloseFile];
@@ -497,6 +527,34 @@
         
     }
 
+}
+- (IBAction)onSetPriceGroup:(id)sender {
+    PriceGroupListViewController * listvc =[[UIStoryboard storyboardWithName:@"SO" bundle:nil] instantiateViewControllerWithIdentifier:@"PriceGroupListViewController"];
+    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    
+    
+    NSMutableDictionary* pricegroup=[RADataProvider all_price_group];
+    NSMutableArray* arrlist = [NSMutableArray new];
+    for(int i=0;i<appDelegate.available_price_group.count;i++)
+    {
+        if(pricegroup[appDelegate.available_price_group[i]]!=nil)
+            [arrlist addObject:appDelegate.available_price_group[i]];
+    }
+    listvc.pricelist = arrlist;//appDelegate.available_price_group;
+    listvc.returnValue = ^(int index) {
+        NSString * pricegroup=appDelegate.available_price_group[index];
+        self.labelPriceGroup.text =pricegroup;
+        appDelegate.price_group = pricegroup;
+        
+        [ActiveViewController Notify:@"CartViewController" Message:@"RA_NOTIFICATION_CART_REFRESH"];
+//        self.server = self.serverlist[index];
+//        [self.btnSelectServer setTitle:self.server[@"show_name"] forState:UIControlStateNormal];
+    };
+    [self.navigationController pushViewController:listvc animated:true];
+    
+    
 }
 
 - (void)scanItemClick:(UIBarButtonItem *)sender {

+ 3 - 1
RedAnt ERP Mobile/HMLG Scan Order/SetupServerViewController.m

@@ -54,7 +54,7 @@
                 NSUInteger selectedIndex = 1;
              
                         // 保存信息
-                        
+                bool b_erp = [self.server[@"has_erp_site"] boolValue];
                         NSString *name = self.server[@"name"];
                 NSString *show_name = self.server[@"show_name"];
                         NSString *internalAddr = self.server[@"url"];
@@ -70,6 +70,8 @@
                         if (name.length) {
                             [addressDic setObject:name forKey:@"name"];
                         }
+                [addressDic setObject:@(b_erp) forKey:@"has_erp_site"];
+                
                 if (show_name.length) {
                     [addressDic setObject:show_name forKey:@"show_name"];
                 }

+ 5 - 3
RedAnt ERP Mobile/HMLG Scan Order/StockViewController.m

@@ -42,10 +42,12 @@
         models[[NSString stringWithFormat:@"item_%d",count]]=self.sdata[k];
         count++;
     }
-    if(self.returnValue)
-        self.returnValue(models);
+
     
-    [self dismissViewControllerAnimated:true completion:nil];
+    [self dismissViewControllerAnimated:true completion:^{
+        if(self.returnValue)
+            self.returnValue(models);
+    }];
     
 }
 - (IBAction)onCancel:(id)sender {

+ 3 - 1
RedAnt ERP Mobile/HMLG Scan Order/config.h

@@ -17,7 +17,7 @@
 #define RA_NOTIFICATION
 
 # ifdef DEBUG
-//#define test_server
+#define test_server
 # endif
 
 #define exception_switch 1
@@ -209,6 +209,8 @@
 
 #endif
 
+//#define URL_AUTOCOMPLETE BASE_URL@"offlineorder_isales.php"
+
 #define URL_SERVER_LIST BASE_URL@"offlineorder_isales.php"
 #define URL_SCAN_NEWS @"offlineorder_isales.php"
 #define URL_SERVER_CHECK @"offlineorder_isales.php"

+ 13 - 5
RedAnt ERP Mobile/common/AppDelegateBase.h

@@ -13,8 +13,10 @@
 #import "iSalesDB.h"
 #import "SyncControlPanelViewController.h"
 
+#ifdef SCANNER_ORDER
 #import "RAUploadManager.h"
 
+#endif
 @protocol ScannerEventsFeedback <NSObject>
 -(void) onDecodedData:(NSString*) value;
 -(void) onErrorInfo:(NSString*) errorInfo;
@@ -198,16 +200,22 @@ typedef enum {
 @property (strong, nonatomic) NSString* uploadurl;
 @property (strong, nonatomic) NSString* address;
 @property (strong, nonatomic) NSString* downloadurl;
-@property (strong, nonatomic)  RAUploadManager *uploadManager;
+//#ifdef SCANNER_ORDER
+//
+//#endif
 @property (nonatomic,assign) BOOL compressFile;
 
 #ifdef SCANNER_ORDER
 @property (strong, nonatomic) NSDictionary* scan_model;
 @property (strong, nonatomic) NSArray* scan_model_key;
-@property (strong, nonatomic) NSString* price0_name;
-@property (strong, nonatomic) NSString* price1_name;
-@property (strong, nonatomic) NSString* price2_name;
-@property (strong, nonatomic) NSString* price3_name;
+//@property (strong, nonatomic) NSString* price0_name;
+//@property (strong, nonatomic) NSString* price1_name;
+//@property (strong, nonatomic) NSString* price2_name;
+//@property (strong, nonatomic) NSString* price3_name;
+@property (strong, nonatomic)  RAUploadManager *uploadManager;
+@property (strong, nonatomic)  NSString *price_group;
+
+@property (strong, nonatomic)  NSArray *available_price_group;
 
 #endif
 @end

+ 63 - 42
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -25,8 +25,10 @@
 #import "AddressEditorViewController.h"
 #import "config.h"
 #import "RASingleton.h"
+#ifdef GOOGLE_ANALYTICS
 #import "Analytics.h"
 #import "GoogleAnalyst.h"
+#endif
 #import "ERPUtils.h"
 #import "RANetwork.h"
 #import "RASingleton.h"
@@ -598,8 +600,9 @@ void UncaughtExceptionHandler(NSException *exception) {
     });
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-
+#ifdef SCANNER_ORDER
         [appDelegate saveUploadTasks];
+#endif
 }
 
 - (void)handleErrorLog {
@@ -988,6 +991,8 @@ void UncaughtExceptionHandler(NSException *exception) {
     
 }
 #endif
+
+#ifdef GOOGLE_ANALYTICS
 - (void)setUpGoogleAnalytics {
     
     // 初始化Google Analytics
@@ -1011,7 +1016,7 @@ void UncaughtExceptionHandler(NSException *exception) {
     //    [[GAI sharedInstance] setDryRun:YES];
     //
 }
-
+#endif
 
 //-(void)test_descrypt
 //{
@@ -1126,7 +1131,7 @@ void UncaughtExceptionHandler(NSException *exception) {
     self.forgroundDate = [NSDate date];
     
     
-    
+#ifdef SCANNER_ORDER
     
     [RAUploadManager configureUploadManager:^(RAUPloadManagerConfigure *configure) {
        
@@ -1137,8 +1142,9 @@ void UncaughtExceptionHandler(NSException *exception) {
         self.uploadManager=[RAUploadManager sharedManager];
     }
     
-    
+#endif
 }
+#ifdef SCANNER_ORDER
 -(RAUploadManager *)uploadManager
 {
     [RAUploadManager configureUploadManager:^(RAUPloadManagerConfigure *configure) {
@@ -1152,6 +1158,7 @@ void UncaughtExceptionHandler(NSException *exception) {
     return _uploadManager;
 }
 
+#endif
 -(void)applicationDidReceiveMemoryWarning:(UIApplication *)application
 {
     DebugLog(@"======================================");
@@ -1160,8 +1167,12 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 - (void)applicationWillTerminate:(UIApplication *)application
 {
+    
+#ifdef SCANNER_ORDER
     // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
     [self saveUploadTasks];
+    
+#endif
 }
 -(void) Logout
 {
@@ -1194,6 +1205,11 @@ void UncaughtExceptionHandler(NSException *exception) {
         [self.recent_model removeAllObjects];
         
         [self SetMode:nil];
+        
+#ifdef SCANNER_ORDER
+        self.available_price_group = nil;
+        [RADataProvider default_price_group];
+#endif
     });
     
 }
@@ -1791,42 +1807,42 @@ void UncaughtExceptionHandler(NSException *exception) {
 //    });
 }
 #ifdef SCANNER_ORDER
-- (NSString *)price0_name
-{
-    if(_price0_name.length==0)
-    {
-        return @"DDP";
-    }
-    else
-        return _price0_name;
-}
-- (NSString *)price1_name
-{
-    if(_price1_name.length==0)
-    {
-        return @"Unit Price";
-    }
-    else
-        return _price1_name;
-}
-- (NSString *)price2_name
-{
-    if(_price2_name.length==0)
-    {
-        return @"Special";
-    }
-    else
-        return _price2_name;
-}
-- (NSString *)price3_name
-{
-    if(_price3_name.length==0)
-    {
-        return @"Net Price";
-    }
-    else
-        return _price3_name;
-}
+//- (NSString *)price0_name
+//{
+//    if(_price0_name.length==0)
+//    {
+//        return @"DDP";
+//    }
+//    else
+//        return _price0_name;
+//}
+//- (NSString *)price1_name
+//{
+//    if(_price1_name.length==0)
+//    {
+//        return @"Unit Price";
+//    }
+//    else
+//        return _price1_name;
+//}
+//- (NSString *)price2_name
+//{
+//    if(_price2_name.length==0)
+//    {
+//        return @"Special";
+//    }
+//    else
+//        return _price2_name;
+//}
+//- (NSString *)price3_name
+//{
+//    if(_price3_name.length==0)
+//    {
+//        return @"Net Price";
+//    }
+//    else
+//        return _price3_name;
+//}
 #endif
 -(void) check_offline:(NSString*) ver useInternalAddress:(bool)buseinternaladdress parentvc:(UIViewController*) parent
 {
@@ -2937,10 +2953,14 @@ void UncaughtExceptionHandler(NSException *exception) {
 
     }
     
-#endif
+
     
     
     self.compressFile = [[RAUPloadManagerConfigure alloc] init].compressImage;
+    
+#endif
+    
+    
 #ifdef OFFLINE_ORDER
     
 #endif
@@ -3784,6 +3804,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 
 
+#ifdef SCANNER_ORDER
 
 #pragma mark - upload manager
 
@@ -3821,5 +3842,5 @@ void UncaughtExceptionHandler(NSException *exception) {
     
     return nil;
 }
-
+#endif
 @end

+ 2 - 0
RedAnt ERP Mobile/common/ERPUtils.m

@@ -9,7 +9,9 @@
 #import "ERPUtils.h"
 #import "AppDelegate.h"
 #import "RASingleton.h"
+#ifdef GOOGLE_ANALYTICS
 #import "GoogleAnalyst.h"
+#endif
 #import "RANetwork.h"
 
 

+ 1 - 1
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -31,7 +31,7 @@
 #import "JKLockController.h"
 #import "RASingleton.h"
 #import "NotificationNameCenter.h"
-#import "OLOSettingViewController.h"
+//#import "OLOSettingViewController.h"
 #import "CustomerEditViewController.h"
 @interface MainViewController ()
 

+ 265 - 173
RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m

@@ -439,7 +439,7 @@
 }
 -(void) newoloorder
 {
-    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
+//    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 //    appDelegate.order_code = order_code;
     
@@ -472,7 +472,7 @@
         //
         //
         
-        [OLDataProvider moveScanTemp2Order];
+//        [OLDataProvider moveScanTemp2Order];
         //        bool bsuccess=[[NSFileManager defaultManager] createDirectoryAtPath:orderdir withIntermediateDirectories:YES attributes:nil error:&error];
         
         
@@ -541,20 +541,9 @@
     
     if(appDelegate.order_code.length>0)
     {
-        //        当前订单先关闭
-        //        [OLDataProvider deleteScanOrder:appDelegate.order_code];
-        appDelegate.order_code = nil;
-        RASingleton.sharedInstance.scan_temp_code = nil;
-        if(appDelegate.customer_type!=USER_ROLE_CUSTOMER ) //customer 角色不清空customer info
-        {   appDelegate.customerInfo = nil;
-            appDelegate.contact_id = nil;
-        }
-        RASingleton.sharedInstance.scan_cart = nil;
-        RASingleton.sharedInstance.price_type = 1;
-        //        [appDelegate updateScanButton:false];
-        
-        [appDelegate update_count_mark];
-        [appDelegate closeOrder];
+//        //        当前订单先关闭
+ 
+        [OLDataProvider scanCloseOrder];
         
     }
     
@@ -563,110 +552,110 @@
     
     
     //    __block MainViewController *brself= self;
-    if(appDelegate.contact_id.length<=0&&false)
-    {
-        
-        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"New Offline Order" message:nil preferredStyle:UIAlertControllerStyleAlert];
-        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"With Offline Contact" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-            
-            //            if(appDelegate.order_code && appDelegate.order_code.length>0)
-            //            {
-            //                [RAUtils message_alert:@"Please close current order and try again." title:@"" controller:self];
-            //            }
-            //            NSLog(@"new click");
-            
-            NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-            
-            //            NSString *path = [[NSBundle mainBundle] pathForResource:@"editContact.json" ofType:nil];
-            
-            CustomerEditViewController * cuseditVC = [[CustomerEditViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
-            cuseditVC.bnewcustomer=true;
-            cuseditVC.bolocustomer = true;
-            cuseditVC.url_type = URL_FILE;
-            cuseditVC.request_url=[OLDataProvider scanTemplatePath:@"scan_contact.json"];
-            
-            cuseditVC.params = params;
-            
-            cuseditVC.returnValue=^(NSMutableDictionary* value)
-            {
-                if(value==nil)
-                {
-                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
-                }
-                else
-                {
-                    NSString* contact_id=[[NSUUID new] UUIDString];
-                    
-                    
-                    //---------------- construct customer_contact----------------------
-                    NSString* customer_first_name = [value valueForKey:@"customer_first_name"];
-                    if(customer_first_name==nil)
-                        customer_first_name=@"";
-                    
-                    NSString* customer_last_name= [value valueForKey:@"customer_last_name"];
-                    if(customer_last_name==nil)
-                        customer_last_name=@"";
-                    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
-                    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-                    [value setValue:customer_contact forKey:@"customer_contact"];
-                    
-                    
-                    
-                    value [@"customer_cid"] = contact_id;
-                    appDelegate.contact_id=contact_id;
-                    appDelegate.customerInfo = value;
-                    
-                    
-                    
-                    
-                    
-                    
-                    //                        [brself refreshContactDisplay];
-                    [self newoloorder];
-                    
-                    //                        [brself switchToCart:nil];
-                    
-                }
-            };
-            
-            
-            //    cuseditVC.delegate=self;
-            //
-            //    if(checked.count==count)
-            //    {
-            //    orderinfoVC.have_tail = true
-            //    }
-            
-            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-            [self.navigationController pushViewController:cuseditVC animated:false];
-            
-            //            [self dismissViewControllerAnimated:NO completion:^{
-            ////                [(UINavigationController*)[self parentViewController] pushViewController:cuseditVC animated:false];;
-            ////                            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-            //
-            ////                            [self pushViewController:cuseditVC animated:false];
-            //            }];
-            
-            //            [[self navigationController] setNavigationBarHidden:NO animated:NO];
-            //            [self.navigationController pushViewController:cuseditVC animated:false];
-            
-            
-        }];
-        
-        
-        
-        UIAlertAction *alertCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-            
-        }];
-        
-        [alertControl addAction:actionOne];
-        
-        //        [alertControl addAction:alertthree];
-        [alertControl addAction:alertCancel];
-        
-        [self presentViewController:alertControl animated:YES completion:nil];
-    }
-    else
+//    if(appDelegate.contact_id.length<=0&&false)
+//    {
+//
+//        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"New Offline Order" message:nil preferredStyle:UIAlertControllerStyleAlert];
+//        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"With Offline Contact" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//
+//            //            if(appDelegate.order_code && appDelegate.order_code.length>0)
+//            //            {
+//            //                [RAUtils message_alert:@"Please close current order and try again." title:@"" controller:self];
+//            //            }
+//            //            NSLog(@"new click");
+//
+//            NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+//
+//            //            NSString *path = [[NSBundle mainBundle] pathForResource:@"editContact.json" ofType:nil];
+//
+//            CustomerEditViewController * cuseditVC = [[CustomerEditViewController alloc] initWithNibName:@"CommonEditor.iPad" bundle:nil];
+//            cuseditVC.bnewcustomer=true;
+//            cuseditVC.bolocustomer = true;
+//            cuseditVC.url_type = URL_FILE;
+//            cuseditVC.request_url=[OLDataProvider scanTemplatePath:@"scan_contact.json"];
+//
+//            cuseditVC.params = params;
+//
+//            cuseditVC.returnValue=^(NSMutableDictionary* value)
+//            {
+//                if(value==nil)
+//                {
+//                    [RAUtils message_alert:@"Cannot create order without customer infomation." title:@"" controller:self];
+//                }
+//                else
+//                {
+//                    NSString* contact_id=[[NSUUID new] UUIDString];
+//
+//
+//                    //---------------- construct customer_contact----------------------
+//                    NSString* customer_first_name = [value valueForKey:@"customer_first_name"];
+//                    if(customer_first_name==nil)
+//                        customer_first_name=@"";
+//
+//                    NSString* customer_last_name= [value valueForKey:@"customer_last_name"];
+//                    if(customer_last_name==nil)
+//                        customer_last_name=@"";
+//                    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
+//                    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+//                    [value setValue:customer_contact forKey:@"customer_contact"];
+//
+//
+//
+//                    value [@"customer_cid"] = contact_id;
+//                    appDelegate.contact_id=contact_id;
+//                    appDelegate.customerInfo = value;
+//
+//
+//
+//
+//
+//
+//                    //                        [brself refreshContactDisplay];
+//                    [self newoloorder];
+//
+//                    //                        [brself switchToCart:nil];
+//
+//                }
+//            };
+//
+//
+//            //    cuseditVC.delegate=self;
+//            //
+//            //    if(checked.count==count)
+//            //    {
+//            //    orderinfoVC.have_tail = true
+//            //    }
+//
+//            [[self navigationController] setNavigationBarHidden:NO animated:NO];
+//            [self.navigationController pushViewController:cuseditVC animated:false];
+//
+//            //            [self dismissViewControllerAnimated:NO completion:^{
+//            ////                [(UINavigationController*)[self parentViewController] pushViewController:cuseditVC animated:false];;
+//            ////                            [[self navigationController] setNavigationBarHidden:NO animated:NO];
+//            //
+//            ////                            [self pushViewController:cuseditVC animated:false];
+//            //            }];
+//
+//            //            [[self navigationController] setNavigationBarHidden:NO animated:NO];
+//            //            [self.navigationController pushViewController:cuseditVC animated:false];
+//
+//
+//        }];
+//
+//
+//
+//        UIAlertAction *alertCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//
+//        }];
+//
+//        [alertControl addAction:actionOne];
+//
+//        //        [alertControl addAction:alertthree];
+//        [alertControl addAction:alertCancel];
+//
+//        [self presentViewController:alertControl animated:YES completion:nil];
+//    }
+//    else
     {
         [self newoloorder];
     }
@@ -731,9 +720,9 @@
     //    NSString *documents = [paths objectAtIndex:0];
     
     NSString *userdir = [OLDataProvider getUserPath];
-    NSMutableDictionary* orderlist = nil;
-    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
-    orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+    NSMutableDictionary* orderlist = [OLDataProvider getScanOrderList];
+//    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
+//    orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
     [self.content_data removeAllObjects];
 
     int count = [orderlist[@"count"] intValue];
@@ -747,9 +736,9 @@
     
     
     
-    NSMutableDictionary* submitlist = nil;
-    NSString *submitlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
-    submitlist=[[RAUtils dictfromfile:submitlistPath] mutableCopy];
+    NSMutableDictionary* submitlist = [OLDataProvider getScanSubmitList];
+//    NSString *submitlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
+//    submitlist=[[RAUtils dictfromfile:submitlistPath] mutableCopy];
     [self.submit_content_data removeAllObjects];
 
     int scount = [submitlist[@"count"] intValue];
@@ -1882,57 +1871,160 @@
             AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
             
             
-            NSMutableDictionary* orderitem =self.content_data[indexPath.row];
-            NSString* ordercode =orderitem[@"order_code"];
-            appDelegate.order_code = ordercode;
-            
-            [appDelegate setUser:orderitem[@"create_by"]];
-            //            appDelegate.user =;
-            //        appDelegate.custo orderitem[@"customer_name"]
-//            appDelegate.user_type = USER_ROLE_EMPLOYEE;
-            appDelegate.can_set_cart_price = true;
-            appDelegate.can_see_price = true;
-            
-            
-            NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
-            
-//            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//            NSString *documents = [paths objectAtIndex:0];
-            
-            
-            
             NSString *orderdir = [OLDataProvider getScanPath];
             //        NSMutableDictionary* order= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"order.json"]] mutableCopy];
             NSMutableDictionary* cart= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"cart.json"]] mutableCopy];
-            NSMutableDictionary* contact= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"contact.json"]] mutableCopy];
-            //        NSMutableDictionary* app= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"app.json"]] mutableCopy];
-            
-            [appDelegate setCustomerInfo: contact];
-            appDelegate.contact_id = contact[@"customer_cid"];
-            RASingleton.sharedInstance.scan_cart = cart;
-            RASingleton.sharedInstance.price_type = [cart[@"price_type"] intValue];
-            
-            
-            [appDelegate update_count_mark];
-            //            [appDelegate updateScanButton:true];
-            [appDelegate SetMode:@""];
-  
-            
-            
-#ifdef RA_NOTIFICATION
-            [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-#else
-            
-            
-            [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-#endif
-            
-//            [self.navigationController pushViewController:orderinfoVC animated:true];
-            
-            [((MainViewController*)appDelegate.main_vc) switchToCart];
-            
-            return;
             
+            if([appDelegate.available_price_group containsObject:cart[@"price_group"]] && [RADataProvider all_price_group][cart[@"price_group"]]!=nil)
+            {
+                NSMutableDictionary* orderitem =self.content_data[indexPath.row];
+                NSString* ordercode =orderitem[@"order_code"];
+                appDelegate.order_code = ordercode;
+                
+                [appDelegate setUser:orderitem[@"create_by"]];
+                //            appDelegate.user =;
+                //        appDelegate.custo orderitem[@"customer_name"]
+    //            appDelegate.user_type = USER_ROLE_EMPLOYEE;
+                appDelegate.can_set_cart_price = true;
+                appDelegate.can_see_price = true;
+                
+                
+                NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+                
+    //            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    //            NSString *documents = [paths objectAtIndex:0];
+                
+                
+                
+
+                NSMutableDictionary* contact= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"contact.json"]] mutableCopy];
+                //        NSMutableDictionary* app= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"app.json"]] mutableCopy];
+                
+                [appDelegate setCustomerInfo: contact];
+                appDelegate.contact_id = contact[@"customer_cid"];
+                RASingleton.sharedInstance.scan_cart = cart;
+                appDelegate.price_group = cart[@"price_group"];
+                RASingleton.sharedInstance.price_type = [cart[@"price_type"] intValue];
+                
+                
+                [appDelegate update_count_mark];
+                //            [appDelegate updateScanButton:true];
+                [appDelegate SetMode:@""];
+      
+                
+                
+    #ifdef RA_NOTIFICATION
+                [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+    #else
+                
+                
+                [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
+    #endif
+                
+    //            [self.navigationController pushViewController:orderinfoVC animated:true];
+                
+                [((MainViewController*)appDelegate.main_vc) switchToCart];
+                
+                return;
+                
+                
+                
+                
+            }
+            else
+            {
+                //价格组不存在 询问刷新
+                
+                NSString * title =@"Price has changes";
+                NSString* message = @"Continue open order will replace all price with new setting";
+                UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
+                //block代码块取代了delegate
+                
+                
+                //        [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
+                //            textField.text = self.save_name;
+                //
+                //
+                //        }];
+                
+                UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Continue" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+                    
+                    
+                    NSMutableDictionary* orderitem =self.content_data[indexPath.row];
+                    NSString* ordercode =orderitem[@"order_code"];
+                    appDelegate.order_code = ordercode;
+                    
+                    [appDelegate setUser:orderitem[@"create_by"]];
+                    //            appDelegate.user =;
+                    //        appDelegate.custo orderitem[@"customer_name"]
+        //            appDelegate.user_type = USER_ROLE_EMPLOYEE;
+                    appDelegate.can_set_cart_price = true;
+                    appDelegate.can_see_price = true;
+                    
+                    
+                    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+                    
+        //            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+        //            NSString *documents = [paths objectAtIndex:0];
+                    
+                    
+                    
+
+                    NSMutableDictionary* contact= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"contact.json"]] mutableCopy];
+                    //        NSMutableDictionary* app= [[RAUtils dictfromfile:[orderdir stringByAppendingPathComponent:@"app.json"]] mutableCopy];
+                    
+                    [appDelegate setCustomerInfo: contact];
+                    appDelegate.contact_id = contact[@"customer_cid"];
+                    //用默认价格组替换订单之前保存的价格组
+                    [RADataProvider default_price_group];
+                    cart[@"price_group"]=appDelegate.price_group;
+                    
+                    RASingleton.sharedInstance.scan_cart = cart;
+
+//                    appDelegate.price_group = cart[@"price_group"];
+                    RASingleton.sharedInstance.price_type = [cart[@"price_type"] intValue];
+                    
+                    
+                    [appDelegate update_count_mark];
+                    //            [appDelegate updateScanButton:true];
+                    [appDelegate SetMode:@""];
+          
+                    
+                    
+        #ifdef RA_NOTIFICATION
+                    [ActiveViewController Notify:@"CartViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+        #else
+                    
+                    
+                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
+        #endif
+                    
+        //            [self.navigationController pushViewController:orderinfoVC animated:true];
+                    
+                    [((MainViewController*)appDelegate.main_vc) switchToCart];
+                    
+                    return;
+                    
+                    
+
+                }];
+                
+                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+                    DebugLog(@"Cancel");
+                    return;
+                }];
+                [alertControl addAction:actionOne];
+                
+                [alertControl addAction:alertthree];
+                
+                //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+                
+                
+                [self presentViewController:alertControl animated:YES completion:nil];
+                
+                
+            }
+
             
         }
         

+ 1 - 1
RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m

@@ -243,7 +243,7 @@
     {
 //        self.scan_val = @"[[\"1111\",\"name0\",\"description\",\"10.1 X 20.2 X 30.3\",\"2\",\"12.34\",\"VIET\",\"VCSF\",\"May\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\"],[\"2222\",\"name1\",\"description\",\"10.1 X 20.2 X 30.3\",\"2\",\"12.34\",\"VIET\",\"VCSF\",\"May\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\",\"123.45\",\"234.56\"]]";
         
-        self.scan_val =@"[\"MT-USH08Q\",\"9468BE-2\",\"1000A70WH\",\"1002A70BK\"]";// @"[\"1002A70BK\"]";// 
+        self.scan_val =@"[\"MT-USH08Q\",\"1438-4\",\"1000A70WH\",\"1002A70BK\"]";// @"[\"1002A70BK\"]";// 
         [self addtocart];
     }
 

+ 1 - 0
RedAnt ERP Mobile/common/Functions/cart/CartViewController.h

@@ -24,6 +24,7 @@
 //@property (strong,nonatomic) NSMutableDictionary* content_data;
 @property (strong,nonatomic) NSMutableArray* content_arr;
 @property (strong,nonatomic) NSDictionary* freejson;
+@property (weak, nonatomic) IBOutlet UIButton *btnBulkDiscount;
 
 @property (weak, nonatomic) IBOutlet UIButton *btnPrice;
 @property (strong,nonatomic) NSString* orderid;

+ 332 - 182
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -777,6 +777,15 @@
 
     [[self navigationController] setNavigationBarHidden:YES animated:NO];
     
+    
+#ifdef SCANNER_ORDER
+    if(appDelegate.user_type == USER_ROLE_EMPLOYEE)
+    {
+        self.btnBulkDiscount.hidden = false;
+    }
+    else
+        self.btnBulkDiscount.hidden = true;
+#endif
 }
 
 - (void)checkProductAvailable:(NSArray *)contents {
@@ -1115,15 +1124,20 @@
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
+//    self.labelPrice0.text = price_group[@"price_0"][@"display"];//appDelegate.price0_name;
+//    self.labelPrice1.text = price_group[@"price_1"][@"display"];//appDelegate.price1_name;
+    
+    
     switch(RASingleton.sharedInstance.price_type)
     {
         case 0:
 //            pricename =[NSString stringWithFormat:@"%@_DDP",shortname];
-            pricename = appDelegate.price0_name;;
+            pricename = price_group[@"price_0"][@"display"];
             break;;
         case 1:
 //            pricename = [NSString stringWithFormat:@"%@_WHSE",shortname];;
-            pricename=appDelegate.price1_name;//@"WHSE";
+            pricename=price_group[@"price_1"][@"display"];//@"WHSE";
             break;;
 //        case 2: pricename = @"25%";
 //            break;
@@ -1219,6 +1233,10 @@
     
     #ifndef RA_NOTIFICATION
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(priceTypeChanged:) name:Change_Price_Type_Notification object:nil];
+    
+#ifdef SCANNER_ORDER
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cartrefresh:) name:@"RA_NOTIFICATION_CART_REFRESH" object:nil];
+#endif
 #endif
     
     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
@@ -1261,6 +1279,10 @@
     [self.view addSubview:self.cartIndicatorBar];
     
 }
+-(void) cartrefresh: (NSNotification *)notification
+{
+    [OLDataProvider scanRefreshCart];
+}
 //-(void)SelectOrder:(NSString *)orderid
 //{
 ////    self.editOrderID.text=orderid;
@@ -1631,9 +1653,103 @@
     
     return;
 }
-- (IBAction)onChangePrice:(id)sender {
+- (IBAction)onBulkDiscount:(id)sender {
+    
+#ifdef SCANNER_ORDER
+    
+    ScanDiscountViewController * vc =[[UIStoryboard storyboardWithName:@"SO" bundle:nil] instantiateViewControllerWithIdentifier:@"ScanDiscountViewController"];
+    
+    
+    
+    vc.bulk = true;
+    
+    vc.discount=0;
+//    vc.price = 0;
+//    vc.cart_id = [item_json valueForKey:@"cart_item_id"];//[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
+//    __block NSString* cartid=[item_json valueForKey:@"cart_item_id"];
+    //    vc.delegate = parentvc.self;
+    //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
+    vc.onSetValue = ^(double price,double discount){
+        
+        bool bmodify=false;
+        if(discount>0)
+            bmodify=true;
+        
+        
+        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Price" completion:^{
+            [RANetwork request_scan_bulkdiscount:discount notes:nil completionHandler:^(NSMutableDictionary *result) {
+                                        NSDictionary* cart_json = result;
+                                        
+                            [waitalert dismissViewControllerAnimated:YES completion:^{
+                                if([[cart_json valueForKey:@"result"] intValue]==2)
+                                {
+//                                    [item_json setValue:[NSNumber numberWithDouble:price ] forKey:@"unit_price"];
+//
+//                                    [item_json setValue:[NSNumber numberWithDouble:discount ] forKey:@"discount"];
+//                                    [item_json setValue:notes forKey:@"note"];
+                                    
+//                                    RASingleton.sharedInstance.scan_cart[@"section_0"][[NSString stringWithFormat:@"item_%d",indexPath.row]]=item_json;
+//                                    if (self.back_order_flag) {
+//                                        [self updateItemJson:item_json atIndexPath:indexPath];
+//                                    } else {
+//                                        self.content_arr[indexPath.row ] = item_json;
+//                                    }
+//                                    tableView.editing = false;
+                                    //                        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+                                    //                        [self refresh_total];
+                                    
+                                    
+                                    [self reload_data];
+                                    
+            #ifdef RA_NOTIFICATION
+                                    [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+            #else
+                                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                                    [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
+            #endif
+                                }
+                                else
+                                {
+                                    [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update Price" controller:self] ;
+                                }
+                            }];
+                                        
+                                       
+                                        
+                                        
+                                        
+                                        
+                        }];
+
+        }];
+   
+       
+    };
+    
+    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc] ;
+    
+    
+    
+    
+    
+    //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+    
+    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+    [self presentViewController:navi animated:YES completion:^{
+        
+        //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+        
+        DebugLog(@"EditModelPriceViewController present.........");
+        
+        //   self.btop = false;
+        //  <#code#>
+    }];
     
+#endif
+}
+- (IBAction)onChangePrice:(id)sender {
     
+#ifdef SCANNER_ORDER
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     if(RASingleton.sharedInstance.scan_cart ==nil)
@@ -1643,11 +1759,13 @@
         RASingleton.sharedInstance.scan_cart=cartTemplate;//[[RAConvertor data2dict:json] mutableCopy];
     }
     
+    
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
     UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Change Price Type" message:nil preferredStyle:UIAlertControllerStyleAlert];
-    UIAlertAction *action1 = [UIAlertAction actionWithTitle:appDelegate.price0_name style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+    UIAlertAction *action1 = [UIAlertAction actionWithTitle:price_group[@"price_0"][@"display"] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 
 //        self.btnPrice.titleLabel.text = @"FOB CTNR";
-        [self.btnPrice setTitle: appDelegate.price0_name forState:UIControlStateNormal];
+        [self.btnPrice setTitle: price_group[@"price_0"][@"display"] forState:UIControlStateNormal];
         RASingleton.sharedInstance.price_type=0;
         NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0"] mutableCopy];
             int count = [section[@"count"] intValue];
@@ -1667,9 +1785,9 @@
         [self.view addSubview:self.cartIndicatorBar];
         [self reload_data];
     }];
-    UIAlertAction *action2 = [UIAlertAction actionWithTitle:appDelegate.price1_name style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+    UIAlertAction *action2 = [UIAlertAction actionWithTitle:price_group[@"price_1"][@"display"] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 
-        [self.btnPrice setTitle: appDelegate.price1_name forState:UIControlStateNormal];
+        [self.btnPrice setTitle: price_group[@"price_1"][@"display"] forState:UIControlStateNormal];
         RASingleton.sharedInstance.price_type=1;
         NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0"] mutableCopy];
             int count = [section[@"count"] intValue];
@@ -1751,18 +1869,21 @@
     [alertControl addAction:alertCancel];
     
     [self presentViewController:alertControl animated:YES completion:nil];
+#endif
 }
 -(void) newoloorder
 {
-    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
+    
+    NSString *orderdir =[OLDataProvider getScanPath];
+//    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
                                 AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                                appDelegate.order_code = order_code;
+//                                appDelegate.order_code = order_code;
     
-    if(appDelegate.user.length==0)
-    {
-        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
-        return;
-    }
+//    if(appDelegate.user.length==0)
+//    {
+//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
+//        return;
+//    }
     
 //    NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:URL_SO_CART ofType:@"json" ]];
 //    NSMutableDictionary* cartTemplate=[OLDataProvider loadScanTemplate:@"scan_cart.json"];
@@ -1780,8 +1901,8 @@
     {
         
         
-        NSString *orderdir =[OLDataProvider getScanPath];
-        [OLDataProvider moveScanTemp2Order];
+
+//        [OLDataProvider moveScanTemp2Order];
         
 //        NSError *error = nil;
 //        bool bsuccess=[[NSFileManager defaultManager] createDirectoryAtPath:orderdir withIntermediateDirectories:YES attributes:nil error:&error];
@@ -1811,7 +1932,16 @@
             UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                 
                 NSMutableDictionary* dict = nil;
-                dict=[OLDataProvider loadScanTemplate:@"e_order.json"];
+                
+//                NSMutableDictionary* dict = nil;
+                
+                NSString* ordertemplate = nil;
+                if([RADataProvider getSiteHasERP])
+                    ordertemplate =@"e_order.json";
+                else
+                    ordertemplate =@"e_order_noerp.json";
+                
+                dict=[OLDataProvider loadScanTemplate:ordertemplate];
                 
                 NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
                 
@@ -1855,7 +1985,7 @@
                 [self scanPlaceOrder];
             }];
             UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                appDelegate.order_code=nil;
+                appDelegate.order_code = nil;
                 DebugLog(@"No");
             }];
             [alertControl addAction:actionOne];
@@ -1923,11 +2053,11 @@
                                 AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 //                                appDelegate.order_code = order_code;
     
-    if(appDelegate.user.length==0)
-    {
-        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
-        return;
-    }
+//    if(appDelegate.user.length==0)
+//    {
+//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
+//        return;
+//    }
     
 //    NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:URL_SO_CART ofType:@"json" ]];
 //    NSMutableDictionary* cartTemplate=[OLDataProvider loadScanTemplate:@"scan_cart.json"];
@@ -1946,7 +2076,7 @@
         
         
         NSString *orderdir =[OLDataProvider getScanPath];
-        [OLDataProvider moveScanTemp2Order];
+//        [OLDataProvider moveScanTemp2Order];
         
 //        NSError *error = nil;
 //        bool bsuccess=[[NSFileManager defaultManager] createDirectoryAtPath:orderdir withIntermediateDirectories:YES attributes:nil error:&error];
@@ -1976,7 +2106,14 @@
             UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
                 
                 NSMutableDictionary* dict = nil;
-                dict=[OLDataProvider loadScanTemplate:@"e_order.json"];
+                
+                NSString* ordertemplate = nil;
+                if([RADataProvider getSiteHasERP])
+                    ordertemplate =@"e_order.json";
+                else
+                    ordertemplate =@"e_order_noerp.json";
+                
+                dict=[OLDataProvider loadScanTemplate:ordertemplate];
                 
                 NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
                 
@@ -2020,7 +2157,7 @@
                 [self scanPlaceOrder];
             }];
             UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                appDelegate.order_code=nil;
+                appDelegate.order_code = nil;
                 DebugLog(@"No");
             }];
             [alertControl addAction:actionOne];
@@ -2121,20 +2258,20 @@
 //    return;
 //}
     
-    if(appDelegate.order_code.length>0)
-    {
-//        当前订单先关闭
-//        [OLDataProvider deleteScanOrder:appDelegate.order_code];
-        appDelegate.order_code = nil;
-        appDelegate.customerInfo = nil;
-        RASingleton.sharedInstance.scan_cart = nil;
-        appDelegate.contact_id = nil;
-//        [appDelegate updateScanButton:false];
-
-        [appDelegate update_count_mark];
-        [appDelegate closeOrder];
-        
-    }
+//    if(appDelegate.order_code.length>0)
+//    {
+////        当前订单先关闭
+////        [OLDataProvider deleteScanOrder:appDelegate.order_code];
+//        appDelegate.order_code = nil;
+//        appDelegate.customerInfo = nil;
+//        RASingleton.sharedInstance.scan_cart = nil;
+//        appDelegate.contact_id = nil;
+////        [appDelegate updateScanButton:false];
+//
+//        [appDelegate update_count_mark];
+//        [appDelegate closeOrder];
+//
+//    }
     
     
 //    RASingleton.sharedInstance.enable_OfflineOrder = true;
@@ -2749,9 +2886,9 @@
                             [waitalert dismissViewControllerAnimated:YES completion:^{
                                 if([[cart_json valueForKey:@"result"] intValue]==2)
                                 {
-                                    [item_json setValue:[NSNumber numberWithDouble:price ] forKey:@"unit_price"];
-                                    
-                                    [item_json setValue:[NSNumber numberWithDouble:discount ] forKey:@"discount"];
+//                                    [item_json setValue:[NSNumber numberWithDouble:price ] forKey:@"unit_price"];
+//                                    
+//                                    [item_json setValue:[NSNumber numberWithDouble:discount ] forKey:@"discount"];
 //                                    [item_json setValue:notes forKey:@"note"];
                                     
 //                                    RASingleton.sharedInstance.scan_cart[@"section_0"][[NSString stringWithFormat:@"item_%d",indexPath.row]]=item_json;
@@ -2838,11 +2975,14 @@
        shortname = servername;
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
+    
     switch(RASingleton.sharedInstance.price_type )
     {
-        case 0: pricename =appDelegate.price0_name;//@"DDP";//[NSString stringWithFormat:@"%@_DDP",shortname];
+        case 0: pricename =price_group[@"price_0"][@"display"];//@"DDP";//[NSString stringWithFormat:@"%@_DDP",shortname];
             break;;
-        case 1: pricename =appDelegate.price1_name;//@"WHSE";//[NSString stringWithFormat:@"%@_WHSE",shortname];;
+        case 1: pricename =price_group[@"price_1"][@"display"];//@"WHSE";//[NSString stringWithFormat:@"%@_WHSE",shortname];;
             break;;
 //        case 2: pricename = @"25%";
 //            break;
@@ -3130,156 +3270,156 @@
 //}
 - (IBAction)OnCancelOrderClicked:(id)sender {
     
-    if (![self isOrderAvailable]) {
-        return;
-    }
-    
-    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Cancel Order" message:@"Are you sure to cancel the order in cart ?" preferredStyle:UIAlertControllerStyleAlert];
-    //block代码块取代了delegate
-    
-    
-    
-    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-           AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Cancel Order" completion:^{
-            
-#ifdef SCANNER_ORDER
-//      if(RASingleton.sharedInstance.enable_OfflineOrder)
-      {
-          [waitalert dismissViewControllerAnimated:YES completion:nil];
-          [OLDataProvider deleteScanOrder:appDelegate.order_code];
-          [appDelegate closeOrder];
-          return;
-      }
-#endif
-            [RANetwork request_cancel_order:nil order_code:appDelegate.order_code completionHandler:^(NSMutableDictionary *result) {
-                        [waitalert dismissViewControllerAnimated:YES completion:^{
-                            NSDictionary* return_json = result;
-                            
-                            if([[return_json valueForKey:@"result"] intValue]==2)
-                            {
-                                //if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
-                                {
-                                    appDelegate.order_code= nil;
-                                    //appDelegate.user_type = 0;
-                                    appDelegate.customerInfo = nil;
-                                    appDelegate.contact_id = nil;
-                                    appDelegate.order_customer_id = nil;
-                                    [appDelegate SetSo:nil];
-                                    appDelegate.cart_count=0;
-                                    [appDelegate update_count_mark];
-                                    
-                                    
-                                }
-            #ifdef RA_NOTIFICATION
-                                [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-            #else
-                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
-            #endif
-                                //[RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
-                                //[self ReloadData];
-                                
-                                //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                                //                    //                        appDelegate.order_code = nil;
-                                //
-                                //                    [appDelegate closeOrder];
-                                //                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-                                [((MainViewController*)appDelegate.main_vc) switchToHome];
-                                
-                                //                    if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
-                                //                    {
-                                //                        [((MainViewController*)appDelegate.main_vc) Loginout:false];
-                                //                    }
-                            }
-                            else
-                            {
-                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
-                            }
-                        }];
-
-
-                        
-                        
-                        
-                        
-                    }];
-
-        }];
-                
-//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-//
-//            NSDictionary* return_json = [RANetwork cancel_Order:nil order_code:appDelegate.order_code];
+//    if (![self isOrderAvailable]) {
+//        return;
+//    }
 //
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                [waitalert dismissViewControllerAnimated:YES completion:nil];
+//    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Cancel Order" message:@"Are you sure to cancel the order in cart ?" preferredStyle:UIAlertControllerStyleAlert];
+//    //block代码块取代了delegate
 //
 //
-//                if([[return_json valueForKey:@"result"] intValue]==2)
-//                {
-//                    //if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
-//                    {
-//                        appDelegate.order_code= nil;
-//                        //appDelegate.user_type = 0;
-//                        appDelegate.customerInfo = nil;
-//                        appDelegate.contact_id = nil;
-//                        appDelegate.order_customer_id = nil;
-//                        [appDelegate SetSo:nil];
-//                        appDelegate.cart_count=0;
-//                        [appDelegate update_count_mark];
 //
+//    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+//           AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Cancel Order" completion:^{
 //
-//                    }
-//#ifdef RA_NOTIFICATION
-//                    [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-//#else
-//                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//                    [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
+//#ifdef SCANNER_ORDER
+////      if(RASingleton.sharedInstance.enable_OfflineOrder)
+//      {
+//          [waitalert dismissViewControllerAnimated:YES completion:nil];
+//          [OLDataProvider deleteScanOrder:appDelegate.order_code];
+//          [appDelegate closeOrder];
+//          return;
+//      }
 //#endif
-//                    //[RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
-//                    //[self ReloadData];
+//            [RANetwork request_cancel_order:nil order_code:appDelegate.order_code completionHandler:^(NSMutableDictionary *result) {
+//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//                            NSDictionary* return_json = result;
+//
+//                            if([[return_json valueForKey:@"result"] intValue]==2)
+//                            {
+//                                //if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
+//                                {
+//                                    appDelegate.order_code = nil;
+//                                    //appDelegate.user_type = 0;
+//                                    appDelegate.customerInfo = nil;
+//                                    appDelegate.contact_id = nil;
+//                                    appDelegate.order_customer_id = nil;
+//                                    [appDelegate SetSo:nil];
+//                                    appDelegate.cart_count=0;
+//                                    [appDelegate update_count_mark];
 //
-////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////                    //                        appDelegate.order_code = nil;
-////
-////                    [appDelegate closeOrder];
-////                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-//                    [((MainViewController*)appDelegate.main_vc) switchToHome];
 //
-////                    if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
+//                                }
+//            #ifdef RA_NOTIFICATION
+//                                [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+//            #else
+//                                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                                [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
+//            #endif
+//                                //[RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
+//                                //[self ReloadData];
+//
+//                                //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                                //                    //                        appDelegate.order_code = nil;
+//                                //
+//                                //                    [appDelegate closeOrder];
+//                                //                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
+//                                [((MainViewController*)appDelegate.main_vc) switchToHome];
+//
+//                                //                    if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
+//                                //                    {
+//                                //                        [((MainViewController*)appDelegate.main_vc) Loginout:false];
+//                                //                    }
+//                            }
+//                            else
+//                            {
+//                                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
+//                            }
+//                        }];
+//
+//
+//
+//
+//
+//
+//                    }];
+//
+//        }];
+//
+////        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+////
+////            NSDictionary* return_json = [RANetwork cancel_Order:nil order_code:appDelegate.order_code];
+////
+////            dispatch_async(dispatch_get_main_queue(), ^{
+////                [waitalert dismissViewControllerAnimated:YES completion:nil];
+////
+////
+////                if([[return_json valueForKey:@"result"] intValue]==2)
+////                {
+////                    //if([appDelegate.order_code isEqualToString: [self.content_data[indexPath.row] valueForKey:@"order_code"]])
 ////                    {
-////                        [((MainViewController*)appDelegate.main_vc) Loginout:false];
+////                        appDelegate.order_code= nil;
+////                        //appDelegate.user_type = 0;
+////                        appDelegate.customerInfo = nil;
+////                        appDelegate.contact_id = nil;
+////                        appDelegate.order_customer_id = nil;
+////                        [appDelegate SetSo:nil];
+////                        appDelegate.cart_count=0;
+////                        [appDelegate update_count_mark];
+////
+////
 ////                    }
-//                }
-//                else
-//                {
-//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
-//                }
+////#ifdef RA_NOTIFICATION
+////                    [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+////#else
+////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+////                    [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
+////#endif
+////                    //[RAUtils message_alert:nil title:@"Order Canceled" controller:self] ;
+////                    //[self ReloadData];
+////
+//////                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//////                    //                        appDelegate.order_code = nil;
+//////
+//////                    [appDelegate closeOrder];
+//////                    [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
+////                    [((MainViewController*)appDelegate.main_vc) switchToHome];
+////
+//////                    if([appDelegate.mode isEqualToString:@"TM"]&& appDelegate.submit_order_logout)
+//////                    {
+//////                        [((MainViewController*)appDelegate.main_vc) Loginout:false];
+//////                    }
+////                }
+////                else
+////                {
+////                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Cancel Order" controller:self] ;
+////                }
+////
+////
+////
+////
+////            });
+////        });
 //
 //
+//    }];
+//
+//    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//        DebugLog(@"No");
+//    }];
+//    [alertControl addAction:actionOne];
+//
+//    [alertControl addAction:alertthree];
+//
+//    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+//
+//
+//    [self presentViewController:alertControl animated:YES completion:nil];
+//
+//    DebugLog(@"%@",self.edit_select_arr);
 //
 //
-//            });
-//        });
-        
-        
-    }];
-    
-    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-        DebugLog(@"No");
-    }];
-    [alertControl addAction:actionOne];
-    
-    [alertControl addAction:alertthree];
-    
-    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-    
-    
-    [self presentViewController:alertControl animated:YES completion:nil];
-    
-    DebugLog(@"%@",self.edit_select_arr);
-    
-    
 
 
 }
@@ -3435,7 +3575,13 @@
     UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
         
         NSMutableDictionary* dict = nil;
-        dict=[OLDataProvider loadScanTemplate:@"e_order.json"];
+        NSString* ordertemplate = nil;
+        if([RADataProvider getSiteHasERP])
+            ordertemplate =@"e_order.json";
+        else
+            ordertemplate =@"e_order_noerp.json";
+        
+        dict=[OLDataProvider loadScanTemplate:ordertemplate];
         
         NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
         
@@ -6168,6 +6314,10 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     [self refresh_ui];
 }
 - (void) reload_data {
+    
+    
+    
+    
     __weak typeof(self) weakself = self;
     self.currentOrderIsMerged = NO;
     NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{

+ 9 - 4
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.h

@@ -8,6 +8,7 @@
 
 #import <UIKit/UIKit.h>
 
+
 @interface OLDataProvider : NSObject
 
 //sales order
@@ -161,14 +162,18 @@ typedef void(^resultHandler)(NSMutableDictionary *result);
 +(NSMutableDictionary*) loadScanTemplate:(NSString*)file;
 +(NSString*) scanTemplatePath:(NSString*)file;
 //+(NSString*) getScanTempPath;
-+(void) createScanTempFolder;
+//+(void) createScanTempFolder;
 //+(NSString*) getScanOrderPath;
 +(NSString*) getUserPath;
 +(NSString*) getScanPath;
-+(void) moveScanTemp2Order;
+//+(void) moveScanTemp2Order;
 +(void) realguestLogin;
 +(NSString*) getScanOrderPath;
 +(NSString*) getScanOrderPathByCode:(NSString*) order_code;
-
-
++(NSMutableDictionary*) getScanOrderList;
++(void) scanCloseOrder;
++(bool) isSavedScanOrder:(NSString*) order_code;
++(void) saveScanOrderList:(NSMutableDictionary*) orderlist;
++(NSMutableDictionary*) getScanSubmitList;
++(void) scanRefreshCart;
 @end

+ 636 - 183
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -23,6 +23,7 @@
 #import "RAConvertor.h"
 #import "ActiveViewController.h"
 #import "RANetwork.h"
+#import "RADataProvider.h"
 @interface OLDataProvider ()
 
 @end
@@ -1912,30 +1913,59 @@
 //    
 //    return;
 //}
-+(void) save2submitScanOrder:(NSString*) soid company:(NSString*) company
+
++(void) saveScanSubmitList:(NSMutableDictionary*) submitlist
 {
     
-    //        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    //        NSString *documents = [paths objectAtIndex:0];
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(submitlist==nil)
+        return;
+    
+    NSString *userdir = [OLDataProvider getUserPath];
+    NSString *submitlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
+    
+    [RAUtils dicttofile:submitlistPath dict:submitlist];
+}
++(void) saveScanOrderList:(NSMutableDictionary*) orderlist
+{
     
+    if(orderlist==nil)
+        return;
     
     NSString *userdir = [OLDataProvider getUserPath];
-    NSMutableDictionary* orderlist = nil;
     NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
+    [RAUtils dicttofile:orderlistPath dict:orderlist];
+}
+
++(NSMutableDictionary*) getScanSubmitList
+{
+    NSString *userdir = [OLDataProvider getUserPath];
+    NSString *submitlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
+
+    NSMutableDictionary* submitlist = nil;
+    if (![[NSFileManager defaultManager] fileExistsAtPath:submitlistPath]) {
+    
+        submitlist = [NSMutableDictionary new];
+    
+    
+    }
+    else
+    {
+        submitlist=[[RAUtils dictfromfile:submitlistPath] mutableCopy];
+    
+    
+    }
+    return submitlist;
+}
++(NSMutableDictionary*) getScanOrderList{
+    NSString *userdir = [OLDataProvider getUserPath];
+    NSMutableDictionary* orderlist = nil;
+    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
     if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
         
-        // order list 为空,不用维护
-#ifdef RA_NOTIFICATION
-        [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
-#else
         
-        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
-#endif
-        return;
+        orderlist = [NSMutableDictionary new];
         
         //                    [orderlist addObject:appDelegate.order_code];
         //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
@@ -1949,11 +1979,56 @@
         
         //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
     }
+    return orderlist;
+}
++(void) save2submitScanOrder:(NSString*) soid company:(NSString*) company
+{
     
+    //        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    //        NSString *documents = [paths objectAtIndex:0];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
-    //==================== order list 删除
+    
+//    NSString *userdir = [OLDataProvider getUserPath];
+    NSMutableDictionary* orderlist = [self getScanOrderList];
+//    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
     int count = [orderlist[@"count"] intValue];
+    if(count==0)
+    {
+        // order list 为空,不用维护
+#ifdef RA_NOTIFICATION
+        [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+#else
+        
+        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
+#endif
+        return;
+    }
+    
+//    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
+//
+//        // order list 为空,不用维护
+//
+//
+//        //                    [orderlist addObject:appDelegate.order_code];
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//
+//    }
+//    else
+//    {
+//        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+//
+//        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
+//
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//    }
+    
+    
+    //==================== order list 删除
+    
+
     
     NSMutableDictionary* newlist  = [NSMutableDictionary new];
     NSMutableDictionary* submititem =nil;
@@ -1973,35 +2048,45 @@
             newcount++;
         }
     }
+    
+    if(submititem==nil)
+    {
+        //order list 里没有和当前打开的order code一致的order
+        //这种情况往往是因为重复点提交按钮,order已关闭。
+        return;
+    }
     newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:newlist];
+    
+    [self saveScanOrderList:newlist];
+//    [RAUtils dicttofile:orderlistPath dict:newlist];
 
     
     
     
     //////////////////---=============================== submitlist 添加
-    NSString *submitlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
+//    NSString *submitlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
     
-    NSMutableDictionary* submitlist = nil;
-    if (![[NSFileManager defaultManager] fileExistsAtPath:submitlistPath]) {
-        
-        submitlist = [NSMutableDictionary new];
-        
-        
-    }
-    else
-    {
-        submitlist=[[RAUtils dictfromfile:submitlistPath] mutableCopy];
-        
-        
-    }
+    NSMutableDictionary* submitlist = [OLDataProvider getScanSubmitList];
+//    if (![[NSFileManager defaultManager] fileExistsAtPath:submitlistPath]) {
+//
+//        submitlist = [NSMutableDictionary new];
+//
+//
+//    }
+//    else
+//    {
+//        submitlist=[[RAUtils dictfromfile:submitlistPath] mutableCopy];
+//
+//
+//    }
     int submitcount =[submitlist[@"count"] intValue];
     submititem[@"order_status"] = soid;//@"Submitted Order";
     submititem[@"customer_name"] = company;//@"Submitted Order";
     
     submitlist[[NSString stringWithFormat:@"item_%d",submitcount]]=submititem;
     submitlist[@"count"] = @(submitcount+1);
-    [RAUtils dicttofile:submitlistPath dict:submitlist];
+//    [RAUtils dicttofile:submitlistPath dict:submitlist];
+    [self saveScanSubmitList:submitlist];
     
 #ifdef RA_NOTIFICATION
     [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
@@ -2020,14 +2105,15 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
-    NSString *userdir = [OLDataProvider getUserPath];
-    NSMutableDictionary* orderlist = nil;
-    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
+//    NSString *userdir = [OLDataProvider getUserPath];
+    NSMutableDictionary* orderlist = [self getScanOrderList];
+//    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
-    
-    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
-        
+    int count = [orderlist[@"count"] intValue];
+    if(count==0)
+    {
         // order list 为空,不用维护
+
 #ifdef RA_NOTIFICATION
         [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
@@ -2036,23 +2122,10 @@
         [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
 #endif
         return;
-        
-        //                    [orderlist addObject:appDelegate.order_code];
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-        
-    }
-    else
-    {
-        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-        
-        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
-        
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+        return;
     }
     
     
-    int count = [orderlist[@"count"] intValue];
-    
     NSMutableDictionary* newlist  = [NSMutableDictionary new];
     
     
@@ -2069,7 +2142,8 @@
         }
     }
     newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:newlist];
+    [self saveScanOrderList:newlist];
+//    [RAUtils dicttofile:orderlistPath dict:newlist];
 #ifdef RA_NOTIFICATION
     [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
@@ -2079,29 +2153,30 @@
 #endif
     
 }
-+(void) createScanTempFolder
-{
-    NSString* scanFilePath = [self getScanTempPath];
-    BOOL bdir=YES;
-    NSFileManager* fileManager = [NSFileManager defaultManager];
-    if(!  [fileManager fileExistsAtPath:scanFilePath isDirectory:&bdir])
-    {
-        
-        NSError *error = nil;
-        bool bsuccess=[fileManager createDirectoryAtPath:scanFilePath withIntermediateDirectories:YES attributes:nil error:&error];
-        
-        if(!bsuccess)
-            DebugLog(@"Create cache folder failed");
-        
-        //        if(bsuccess)
-        //        {
-        //            sqlite3 *db = [self get_db];
-        //
-        //            [self execSql:[NSString stringWithFormat:@"insert into img_cache(name) values('%@')",name] db:db];
-        //            [iSalesDB close_db:db];
-        //        }
-    }
-}
+//+(void) createScanTempFolder
+//{
+//    return;
+////    NSString* scanFilePath = [self getScanTempPath];
+////    BOOL bdir=YES;
+////    NSFileManager* fileManager = [NSFileManager defaultManager];
+////    if(!  [fileManager fileExistsAtPath:scanFilePath isDirectory:&bdir])
+////    {
+////
+////        NSError *error = nil;
+////        bool bsuccess=[fileManager createDirectoryAtPath:scanFilePath withIntermediateDirectories:YES attributes:nil error:&error];
+////
+////        if(!bsuccess)
+////            DebugLog(@"Create cache folder failed");
+////
+////        //        if(bsuccess)
+////        //        {
+////        //            sqlite3 *db = [self get_db];
+////        //
+////        //            [self execSql:[NSString stringWithFormat:@"insert into img_cache(name) values('%@')",name] db:db];
+////        //            [iSalesDB close_db:db];
+////        //        }
+////    }
+//}
 +(NSString*) getScanOrderPathByCode:(NSString*) order_code
 {
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
@@ -2170,30 +2245,33 @@
     }
     return orderpath;
 }
-+(NSString*) getScanTempPath
-{
-    
-    if(RASingleton.sharedInstance.scan_temp_code == nil)
-        RASingleton.sharedInstance.scan_temp_code = [self createScanTempCode];
-    return [NSTemporaryDirectory() stringByAppendingPathComponent:RASingleton.sharedInstance.scan_temp_code];
-}
-+(void) moveScanTemp2Order
-{
-    NSString *orderdir = [OLDataProvider getScanOrderPath];
-    NSError *error = nil;
-    NSString* tempdir = [OLDataProvider getScanTempPath];
-    
-    //    NSArray* arr_files=[RAUtils allFilesAtPath:tempdir];
-    //    for(int i=0;i<arr_files.count;i++)
-    //    {
-    //        NSString* file=arr_files[i];
-    //
-    //
-    //    }
-    [ [NSFileManager defaultManager] moveItemAtPath:[tempdir stringByAppendingPathComponent:@"cart.json"] toPath:[orderdir stringByAppendingPathComponent:@"cart.json"] error:&error];
-    
-    
-}
+//+(NSString*) getScanTempPath
+//{
+//    return nil;
+////
+////    if(RASingleton.sharedInstance.scan_temp_code == nil)
+////        RASingleton.sharedInstance.scan_temp_code = [self createScanTempCode];
+////    return [NSTemporaryDirectory() stringByAppendingPathComponent:RASingleton.sharedInstance.scan_temp_code];
+//}
+//+(void) moveScanTemp2Order
+//{
+//    return;
+////    NSString *orderdir = [OLDataProvider getScanOrderPath];
+////    
+////    NSError *error = nil;
+////    NSString* tempdir = [OLDataProvider getScanTempPath];
+////    
+////    //    NSArray* arr_files=[RAUtils allFilesAtPath:tempdir];
+////    //    for(int i=0;i<arr_files.count;i++)
+////    //    {
+////    //        NSString* file=arr_files[i];
+////    //
+////    //
+////    //    }
+////    [ [NSFileManager defaultManager] moveItemAtPath:[tempdir stringByAppendingPathComponent:@"cart.json"] toPath:[orderdir stringByAppendingPathComponent:@"cart.json"] error:&error];
+////    
+//    
+//}
 
 +(NSString*) getUserPath
 {
@@ -2209,20 +2287,75 @@
     userpath = [userpath stringByAppendingPathComponent:user];
     return userpath;
 }
+
++(bool) isSavedScanOrder:(NSString*) order_code
+{
+    if(order_code == nil)
+        return false;
+    NSMutableDictionary * orderlist=[self getScanOrderList];
+    int count = [orderlist[@"count"] intValue];
+    
+    
+    
+    
+    for(int i=0;i<count;i++)
+    {
+        NSMutableDictionary* item = orderlist[[NSString stringWithFormat:@"item_%d",i]];
+        if([item[@"order_code"] isEqualToString: order_code ])
+        {
+            return true;
+        }
+
+    }
+    return false;
+}
+
 +(NSString*) getScanPath
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.order_code!=nil)
+    
+    
+    if(appDelegate.order_code==nil)
     {
-        return [self getScanOrderPath];
+        appDelegate.order_code=[[NSUUID new] UUIDString];
+        
     }
-    else
+    return [self getScanOrderPath];
+//    else
+//    {
+//        [self createScanTempFolder];
+//        return [self getScanTempPath];
+//    }
+}
++(void) scanCloseOrder
+{
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+//    if(appDelegate.user.length<=0)
+//    {
+//        [RAUtils message_alert:@"Please login first." title:@"Warring" controller:self];
+//        return;
+//    }
+    
+//    if(appDelegate.order_code.length>0)
     {
-        [self createScanTempFolder];
-        return [self getScanTempPath];
+        //        当前订单先关闭
+        //        [OLDataProvider deleteScanOrder:appDelegate.order_code];
+        appDelegate.order_code = nil;
+//        RASingleton.sharedInstance.scan_temp_code = nil;
+        if(appDelegate.customer_type!=USER_ROLE_CUSTOMER ) //customer 角色不清空customer info
+        {   appDelegate.customerInfo = nil;
+            appDelegate.contact_id = nil;
+        }
+        RASingleton.sharedInstance.scan_cart = nil;
+        RASingleton.sharedInstance.price_type = 1;
+        //        [appDelegate updateScanButton:false];
+        
+        [appDelegate update_count_mark];
+        [appDelegate closeOrder];
+        
     }
 }
-
 +(NSString*) createScanTempCode
 {
     return [[NSUUID new] UUIDString];
@@ -2265,28 +2398,25 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
-    if([appDelegate.order_code isEqualToString:order_code])
-    {
-        //要删除的订单是当前打开的订单;
-        appDelegate.order_code = nil;
-        appDelegate.customerInfo = nil;
-        RASingleton.sharedInstance.scan_cart = nil;
-        appDelegate.contact_id = nil;
-        //        [appDelegate updateScanButton:false];
-        
-        [appDelegate update_count_mark];
-    }
+//    if([appDelegate.order_code isEqualToString:order_code])
+//    {
+//        //要删除的订单是当前打开的订单;
+//        appDelegate.order_code = nil;
+//        appDelegate.customerInfo = nil;
+//        RASingleton.sharedInstance.scan_cart = nil;
+//        appDelegate.contact_id = nil;
+//        //        [appDelegate updateScanButton:false];
+//        
+//        [appDelegate update_count_mark];
+//    }
     //删除订单目录
     [[NSFileManager defaultManager] removeItemAtPath:[userdir stringByAppendingPathComponent:order_code] error:nil];
     //维护订单列表
-    NSMutableDictionary* orderlist = nil;
+    NSMutableDictionary* submitlist = [self getScanSubmitList];
     
-    
-    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
-    
-    
-    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
-        
+    int count = [submitlist[@"count"] intValue];
+    if(count==0)
+    {
         // order list 为空,不用维护
         
         
@@ -2299,22 +2429,29 @@
         [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
 #endif
         return;
-        
-        //                    [orderlist addObject:appDelegate.order_code];
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-        
-    }
-    else
-    {
-        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-        
-        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
-        
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
     }
+//    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"submitlist.json"];
+    
+//
+//    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
+//
+//
+//
+//        //                    [orderlist addObject:appDelegate.order_code];
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//
+//    }
+//    else
+//    {
+//        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+//
+//        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
+//
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//    }
     
     
-    int count = [orderlist[@"count"] intValue];
+
     
     NSMutableDictionary* newlist  = [NSMutableDictionary new];
     
@@ -2322,7 +2459,7 @@
     int newcount = 0;
     for(int i=0;i<count;i++)
     {
-        NSMutableDictionary* item = orderlist[[NSString stringWithFormat:@"item_%d",i]];
+        NSMutableDictionary* item = submitlist[[NSString stringWithFormat:@"item_%d",i]];
         if([item[@"order_code"] isEqualToString: order_code ])
             continue;
         else
@@ -2332,7 +2469,9 @@
         }
     }
     newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:newlist];
+//    [RAUtils dicttofile:orderlistPath dict:newlist];
+    [self saveScanSubmitList:newlist];
+    
 #ifdef RA_NOTIFICATION
     [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
@@ -2354,14 +2493,10 @@
     
     
   
-    NSMutableDictionary* orderlist = nil;
-    
-    
-    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
-    
-    
-    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
-        
+    NSMutableDictionary* orderlist = [self getScanOrderList];
+    int count = [orderlist[@"count"] intValue];
+    if(count==0)
+    {
         // order list 为空,不用维护
         
         
@@ -2370,22 +2505,30 @@
         
 
         return;
-        
-        //                    [orderlist addObject:appDelegate.order_code];
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-        
-    }
-    else
-    {
-        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-        
-        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
-        
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
     }
     
+//    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
-    int count = [orderlist[@"count"] intValue];
+    
+//    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
+//
+//
+//
+//        //                    [orderlist addObject:appDelegate.order_code];
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//
+//    }
+//    else
+//    {
+//        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+//
+//        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
+//
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//    }
+//
+//
+//    int count = [orderlist[@"count"] intValue];
     
 //    NSMutableDictionary* newlist  = [NSMutableDictionary new];
     
@@ -2434,7 +2577,9 @@
        
     }
 //    newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:orderlist];
+    
+    [self saveScanOrderList:orderlist];
+//    [RAUtils dicttofile:orderlistPath dict:orderlist];
 
     [ActiveViewController Notify:@"ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 
@@ -2454,10 +2599,11 @@
     if([appDelegate.order_code isEqualToString:order_code])
     {
         //要删除的订单是当前打开的订单;
-        appDelegate.order_code = nil;
-        appDelegate.customerInfo = nil;
-        RASingleton.sharedInstance.scan_cart = nil;
-        appDelegate.contact_id = nil;
+//        appDelegate.order_code = nil;
+//        appDelegate.customerInfo = nil;
+//        RASingleton.sharedInstance.scan_cart = nil;
+//        appDelegate.contact_id = nil;
+        [self scanCloseOrder];
         //        [appDelegate updateScanButton:false];
         
         [appDelegate update_count_mark];
@@ -2465,14 +2611,12 @@
     //删除订单目录
     [[NSFileManager defaultManager] removeItemAtPath:[userdir stringByAppendingPathComponent:order_code] error:nil];
     //维护订单列表
-    NSMutableDictionary* orderlist = nil;
-    
-    
-    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
+    NSMutableDictionary* orderlist = [self getScanOrderList];
     
+    int count = [orderlist[@"count"] intValue];
     
-    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
-        
+    if(count==0)
+    {
         // order list 为空,不用维护
         
         
@@ -2485,22 +2629,29 @@
         [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
 #endif
         return;
-        
-        //                    [orderlist addObject:appDelegate.order_code];
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-        
-    }
-    else
-    {
-        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-        
-        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
-        
-        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
     }
+//    NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
     
-    int count = [orderlist[@"count"] intValue];
+//    if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
+//
+//
+//
+//        //                    [orderlist addObject:appDelegate.order_code];
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//
+//    }
+//    else
+//    {
+//        orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+//
+//        //                    [orderlist insertObject:appDelegate.order_code atIndex:0];
+//
+//        //                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//    }
+    
+    
+
     
     NSMutableDictionary* newlist  = [NSMutableDictionary new];
     
@@ -2518,7 +2669,8 @@
         }
     }
     newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:newlist];
+    [self saveScanOrderList:newlist];
+//    [RAUtils dicttofile:orderlistPath dict:newlist];
 #ifdef RA_NOTIFICATION
     [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
 #else
@@ -2527,9 +2679,310 @@
     [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
 #endif
 }
++(void) scanRefreshCart
+{
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSMutableDictionary* cart =[[RAUtils copyDict: RASingleton.sharedInstance.scan_cart] mutableCopy];
+    NSMutableDictionary * section = cart[@"section_0"];
+    NSMutableDictionary* newsection = [NSMutableDictionary new];
+    int count = [section[@"count"] intValue];
+    int newcount = 0;
+    for(int i=0;i<count;i++)
+    {
+        
+        NSMutableDictionary* item = [section[[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
+        NSString* model = item[@"model"];
+        NSDictionary* modeljson=appDelegate.scan_model[model];
+        
+        if(modeljson==nil)
+            continue;
+        
+        NSMutableDictionary* cartitem = [[self scanmodel2cartitem:[modeljson mutableCopy]] mutableCopy];
+        cartitem[@"note"]=item[@"note"];
+        cartitem[@"discount"]=item[@"discount"];
+//        [item removeObjectForKey:@"discount"];
+//        [item removeObjectForKey:@"note"];
+        newsection[[NSString stringWithFormat:@"item_%d",newcount]]=cartitem;
+        newcount++;
+    }
+    RASingleton.sharedInstance.scan_cart[@"section_0"]=newsection;
+}
+
++(NSDictionary*) scanmodel2cartitem:(NSMutableDictionary*) _modelJson
+{
+//    _modelJson = modelJson;
+    
+    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+//    self.labelPrice0.text = appDelegate.price0_name;
+//    self.labelPrice1.text = appDelegate.price1_name;
+//    self.labelPrice2.text = appDelegate.price2_name;
+//    self.labelPrice3.text = appDelegate.price3_name;
+    NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
+//    self.labelPrice0.text = price_group[@"price_0"][@"display"];//appDelegate.price0_name;
+//    self.labelPrice1.text = price_group[@"price_1"][@"display"];//appDelegate.price1_name;
+//    self.labelPrice2.text = price_group[@"price_2"][@"display"];//appDelegate.price2_name;
+//    self.labelPrice3.text = price_group[@"price_3"][@"display"];//appDelegate.price3_name;
+
+    NSLog( [RAConvertor dict2string:_modelJson]);
+    
+    NSString * port=_modelJson[@"port"];
+    if(port.length==0)
+        port = @"N/A";
+    
+    NSString * origin=_modelJson[@"origin"];
+    if(origin.length==0)
+        origin = @"N/A";
+    NSString * dimension=_modelJson[@"dimension"];
+    if(dimension.length==0)
+        dimension = @"N/A";
+    
+//    _labelModel.text=_modelJson[@"model"];
+//    _labelDescription.text=_modelJson[@"description"];
+//    _labelDimension.text=dimension;
+//    _labelCuft.text=_modelJson[@"unit_cuft"];
+//    _labelOrigin.text=origin;
+//    _labelPort.text=port;
+    NSString* price0=_modelJson[price_group[@"price_0"][@"name"]]; //DDP
+    NSString* price1=_modelJson[price_group[@"price_1"][@"name"]]; //WHSE
+    NSString* price2=_modelJson[price_group[@"price_2"][@"name"]]; //SHOW
+    NSString* price3=_modelJson[price_group[@"price_3"][@"name"]]; //NET
+ 
+    
+    
+    if(![price0 isEqualToString: @"N/A"])
+        price0 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_0"][@"name"]] doubleValue]];
+    if(![price1 isEqualToString: @"N/A"])
+        price1 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_1"][@"name"]] doubleValue]];
+    if(![price2 isEqualToString: @"N/A"])
+    {
+        price2 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_2"][@"name"]] doubleValue]];
+//        if(RASingleton.sharedInstance.price_type==1)
+            _modelJson [@"special_price"] = @true;
+    }
+    if(![price3 isEqualToString: @"N/A"])
+        price3 = [NSString stringWithFormat:@"%.2f",[_modelJson[price_group[@"price_3"][@"name"]] doubleValue]];
+
+//    if(![_modelJson [@"special_price"] boolValue]&& ![price1 isEqualToString: @"N/A"] && [price1 isEqual:price3])
+    if((![price1 isEqualToString: @"N/A"] && [price1 isEqual:price3])||(![price2 isEqualToString: @"N/A"] && [price2 isEqual:price3]))
+    {
+//        if(RASingleton.sharedInstance.price_type==1)
+            _modelJson [@"net_price"] = @true;
+    }
+    
+    
+//
+//    if(![price1 isEqualToString:@"N/A"])
+//    {
+//        price2 =  [NSString stringWithFormat:@"%.2f",[_modelJson[@"price1"] doubleValue] *1.25];
+//        _modelJson[@"price2"]= price2;
+//    }
+//    else
+//    {
+//        price2=@"N/A";
+//    }
+//
+    
+ 
+//    if([price0 isEqualToString:@"N/A"])
+//        _labelPriceCTNR.text= @"";//price0;
+//    else
+//        _labelPriceCTNR.text=[RAConvertor currencyNumber:[price0 floatValue]];
+    
+//
+//    if([price3 isEqualToString:@"N/A"])
+//        _labelPriceNCA.text= price3;
+//    else
+//        _labelPriceNCA.text=[RAConvertor currencyNumber:[price3 floatValue]];
+//    _labelPrice25p.text=price2;
+    
+//
+//    if([_modelJson [@"special_price"] boolValue])
+//    {
+//        if([_modelJson[price_group[@"price_2"][@"name"]] isEqualToString:@"N/A"])
+//            _labelPriceSpecial.text=@"";//_modelJson[@"price2"];
+//        else
+//            _labelPriceSpecial.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_2"][@"name"]] floatValue]];
+//    }
+//    else
+//    {
+//        _labelPriceSpecial.text=@"";//@"N/A";
+//    }
+//
+    
+//    if([_modelJson [@"net_price"] boolValue])
+//    {
+////        if([_modelJson[@"price1"] isEqualToString:@"N/A"])
+////        {
+////            _labelPriceNet.text=_modelJson[@"price1"];
+//////            _labelPriceNCA.text=@"N/A";
+////        }
+////        else
+////        {
+////            _labelPriceNet.text=[RAConvertor currencyNumber:[_modelJson[@"price1"] floatValue]];
+//////            _labelPriceNCA.text=@"N/A";
+////        }
+//
+//        if([_modelJson[price_group[@"price_3"][@"name"]] isEqualToString:@"N/A"])
+//        {
+//            _labelPriceNet.text=@"";//_modelJson[@"price3"];
+////            _labelPriceNCA.text=@"N/A";
+//        }
+//        else
+//        {
+//            _labelPriceNet.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_3"][@"name"]] floatValue]];
+////            _labelPriceNCA.text=@"N/A";
+//        }
+//
+//    }
+//    else
+//    {
+//        _labelPriceNet.text=@"";//@"N/A";
+//    }
+//
+//    {
+//        if([_modelJson[price_group[@"price_1"][@"name"]] isEqualToString:@"N/A"])
+//        {
+//            _labelPriceNCA.text=@"";//_modelJson[@"price1"];
+////            _labelPriceNCA.text=@"N/A";
+//        }
+//        else
+//        {
+//            _labelPriceNCA.text=[RAConvertor currencyNumber:[_modelJson[price_group[@"price_1"][@"name"]] floatValue]];
+////            _labelPriceNet.text=@"N/A";
+//        }
+//    }
+    
+    
+    NSString * available=_modelJson[@"available"];
+    if(available.length==0)
+        available = @"N/A";
+    
+//    _labelAvailable.text=available;
+    NSString * unit_cuft=_modelJson[@"unit_cuft"];
+    if(unit_cuft.length==0)
+        unit_cuft = @"N/A";
+    else
+    {
+        
+        unit_cuft = [NSString stringWithFormat:@"%.2f", [_modelJson[@"unit_cuft"] doubleValue]];
+    }
+    
+    NSString * cell_price;
+
+    if(RASingleton.sharedInstance.price_type==1)
+    {
+//        if(_modelJson [@"net_price"])
+            cell_price=_modelJson[price_group[@"price_3"][@"name"]];
+//        else if(_modelJson [@"special_price"])
+//        {
+//            unit_price= _modelJson[@"price2"];
+//        }
+//        else
+//        {
+//            unit_price= _modelJson[@"price1"];
+//        }
+    }
+    else
+    {
+        cell_price=_modelJson[price_group[@"price_0"][@"name"]];
+    }
+    
+    
+
+  
+    
+    
+    NSString * mpack=_modelJson[@"stockUom"];
+    if([mpack isEqualToString:@"N/A"])
+        mpack=@"1";
+    _modelJson[@"count"]=_modelJson[@"stockUom"];
+    _modelJson[@"cuft"] = @([mpack intValue]* [unit_cuft doubleValue]);
+    _modelJson[@"subtotal_price"] = @([mpack intValue]* [cell_price doubleValue]);
+
+
+    
+    NSMutableDictionary* jitem = nil;
+     jitem = [_modelJson mutableCopy];
+int stockUom =[jitem[@"stockUom"] intValue];
+if(stockUom==0)
+    stockUom=1;
+    bool newitem = true;
+//AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//NSDictionary* price_group = [RADataProvider get_price_group:appDelegate.price_group];
+//    for(int i=0;i<count;i++)
+//    {
+//
+//        NSMutableDictionary* litem = [section[[NSString stringWithFormat:@"item_%i",i]] mutableCopy];
+//
+//        if([litem[@"product_id"] isEqualToString:jitem[@"product_id"]])
+//        {
+//
+////                    int oldcount = [litem[@"stockUom"] intValue];
+//            newitem = false;
+//
+//            litem[@"count"]=@([litem[@"count"] intValue] +[jitem[@"count"] intValue]);
+//            litem[@"cuft"]=@([litem[@"count"] intValue] * [litem[@"unit_cuft"] doubleValue]);
+//
+//            section[[NSString stringWithFormat:@"item_%i",i]] = litem;
+//            break;
+//
+//
+//        }
+//
+//
+//
+//    }
+//    if(true)
+//    {
+        jitem[@"count"]=@(stockUom);
+        jitem[@"check"]=@(true);
+        jitem[@"cart_item_id"]=[NSUUID UUID].UUIDString;
+        
+        NSString * unit_price;
+        if(RASingleton.sharedInstance.price_type==0)
+            unit_price=_modelJson[price_group[@"price_0"][@"name"]];
+        else if(_modelJson [@"special_price"])
+        {
+            unit_price= _modelJson[price_group[@"price_2"][@"name"]];
+        }
+        else if(_modelJson [@"net_price"])
+            unit_price=_modelJson[price_group[@"price_3"][@"name"]];
+        else
+        {
+            unit_price= _modelJson[price_group[@"price_1"][@"name"]];
+        }
 
+        if([unit_price isEqualToString:@"N/A"])
+            unit_price = @"0";
+        else
+        {
+            
+            unit_price = [NSString stringWithFormat:@"%.2f", [unit_price doubleValue]];
+        }
+        
+        
+        jitem[@"unit_price"] = unit_price;
+        jitem[@"erp_unit_price"] = unit_price;
+        
+        
+//        section[[NSString stringWithFormat:@"item_%i",count]] = jitem;
+//        section[@"count"]= @(count+1);
+//        count++;
+        
+//    }
+    
+    
+    
+    
+    return jitem;
+}
 +(void) saveScanCart:(NSMutableDictionary*) cart
 {
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.order_code.length<=0)
+        return;
     if(cart==nil)
         return;
     //    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

+ 164 - 47
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -47,7 +47,14 @@
     UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Existing Customer" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
         
         NSMutableDictionary* dict = nil;
-        dict=[OLDataProvider loadScanTemplate:@"e_order.json"];
+        
+        NSString* ordertemplate = nil;
+        if([RADataProvider getSiteHasERP])
+            ordertemplate =@"e_order.json";
+        else
+            ordertemplate =@"e_order_noerp.json";
+        dict=[OLDataProvider loadScanTemplate:ordertemplate];
+        
         
         NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
         
@@ -649,7 +656,7 @@
                                                           style:UIBarButtonItemStylePlain
                                                          target:self
                                                          action:@selector(onCommitOrderClick:)];
-    
+
     
     UIBarButtonItem *fixedItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
     fixedItem.width = 20.0f;
@@ -727,7 +734,7 @@
         [self.btnSubmitOrder setImage:nil];
         self.btnSubmitOrder.enabled = false;
     }
-    
+
     self.navigationController.navigationBarHidden=false;
     
 }
@@ -1044,7 +1051,40 @@
         
         UIAlertAction *action_0 = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
 
-            [self onSaveClick:nil];
+//            [self onSaveClick:nil];
+            
+            // add params check here.
+            [self.lastedit endEditing:true];
+            [self.lasttextview endEditing:true];
+
+            
+            NSMutableDictionary* upparams = [self check_cancommit:false];
+        //    if(self.cancommit==false)
+        //        return;
+            
+            if([upparams[@"shipping"] isEqualToString:@"Shipping To Be Quoted"]||[upparams[@"shipping"] isEqualToString:@"To Be Quoted"])
+                upparams[@"shipping"] = nil;
+            
+            
+//        #ifdef SCANNER_ORDER
+            
+        //    if(RASingleton.sharedInstance.enable_OfflineOrder)
+            {
+                
+        //        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+        //        NSString *documents = [paths objectAtIndex:0];
+
+                [self scanSave:upparams];
+                
+                [RAUtils message_alert:@"Save Successfully" title:@"Message" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
+                    
+//                    [self newScanOrder];
+                    [self.navigationController popViewControllerAnimated:true];
+                    
+                } completion:nil];
+                return;
+            }
+            
         }];
         
         UIAlertAction *action_1 = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
@@ -1456,34 +1496,36 @@
     
     RASingleton.sharedInstance.scan_cart[@"price_type"] = @(RASingleton.sharedInstance.price_type);
     
-    [RAUtils dicttofile:cartpath dict:RASingleton.sharedInstance.scan_cart];
-    
-    
+    RASingleton.sharedInstance.scan_cart[@"price_group"] = appDelegate.price_group;
     
+    [RAUtils dicttofile:cartpath dict:RASingleton.sharedInstance.scan_cart];
     
-    NSMutableDictionary* orderlist = nil;
     
     
-        NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
     
+    NSMutableDictionary* orderlist = [OLDataProvider getScanOrderList];
     
-            if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
- 
-                
-                orderlist = [NSMutableDictionary new];
-                
-//                    [orderlist addObject:appDelegate.order_code];
-//                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-                
-          }
-            else
-            {
-                orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
-                
-//                    [orderlist insertObject:appDelegate.order_code atIndex:0];
- 
-//                    [RAUtils dicttofile:orderlistPath dict:orderlist];
-            }
+//
+//        NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
+//
+//
+//            if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
+//
+//
+//                orderlist = [NSMutableDictionary new];
+//
+////                    [orderlist addObject:appDelegate.order_code];
+////                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//
+//          }
+//            else
+//            {
+//                orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
+//
+////                    [orderlist insertObject:appDelegate.order_code atIndex:0];
+//
+////                    [RAUtils dicttofile:orderlistPath dict:orderlist];
+//            }
     
     NSMutableDictionary* orderitem = [NSMutableDictionary new];
     orderitem[@"create_by"] = appDelegate.user;
@@ -1516,11 +1558,19 @@
     
     newlist[@"item_0"]=orderitem;
     int newcount = 1;
+    int checkordercode = 0;
     for(int i=0;i<count;i++)
     {
         NSMutableDictionary* item = orderlist[[NSString stringWithFormat:@"item_%d",i]];
         if([item[@"order_code"] isEqualToString: appDelegate.order_code ])
+        {
+            checkordercode++;
+            if(checkordercode>1)
+            {
+                int dbg=1;
+            }
             continue;
+        }
         else
         {
             newlist[[NSString stringWithFormat:@"item_%d",newcount]] = item;
@@ -1528,7 +1578,8 @@
         }
     }
     newlist[@"count"] = @(newcount);
-    [RAUtils dicttofile:orderlistPath dict:newlist];
+    [OLDataProvider saveScanOrderList:newlist];
+//    [RAUtils dicttofile:orderlistPath dict:newlist];
 #ifdef RA_NOTIFICATION
     [ActiveViewController Notify:@"CartViewController,ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
     
@@ -1553,20 +1604,22 @@
     
     if(appDelegate.order_code.length>0)
     {
-        //        当前订单先关闭
-        //        [OLDataProvider deleteScanOrder:appDelegate.order_code];
-        appDelegate.order_code = nil;
-        RASingleton.sharedInstance.scan_temp_code = nil;
-        if(appDelegate.customer_type!=USER_ROLE_CUSTOMER ) //customer 角色不清空customer info
-        {   appDelegate.customerInfo = nil;
-            appDelegate.contact_id = nil;
-        }
-        RASingleton.sharedInstance.scan_cart = nil;
-        RASingleton.sharedInstance.price_type = 1;
-        //        [appDelegate updateScanButton:false];
+//        //        当前订单先关闭
+//        //        [OLDataProvider deleteScanOrder:appDelegate.order_code];
+//        appDelegate.order_code = nil;
+//        RASingleton.sharedInstance.scan_temp_code = nil;
+//        if(appDelegate.customer_type!=USER_ROLE_CUSTOMER ) //customer 角色不清空customer info
+//        {   appDelegate.customerInfo = nil;
+//            appDelegate.contact_id = nil;
+//        }
+//        RASingleton.sharedInstance.scan_cart = nil;
+//        RASingleton.sharedInstance.price_type = 1;
+//        //        [appDelegate updateScanButton:false];
+//
+//        [appDelegate update_count_mark];
+//        [appDelegate closeOrder];
         
-        [appDelegate update_count_mark];
-        [appDelegate closeOrder];
+        [OLDataProvider scanCloseOrder];
         
     }
     
@@ -1575,7 +1628,7 @@
     
     
     //    __block MainViewController *brself= self;
-    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
+//    NSString* order_code = RASingleton.sharedInstance.scan_temp_code;
     appDelegate.can_set_cart_price = true;
     appDelegate.can_see_price = true;
     RASingleton.sharedInstance.scan_cart = nil;
@@ -1585,7 +1638,7 @@
         
         
         NSString *orderdir = [OLDataProvider getScanPath];
-        [OLDataProvider moveScanTemp2Order];
+//        [OLDataProvider moveScanTemp2Order];
         
         
         
@@ -3044,6 +3097,7 @@
 //        });
 //    });
 }
+#ifdef SCANNER_ORDER
 -(void)addTasks: (NSString*)filename md5:(NSString*) md5
 {
     
@@ -3099,8 +3153,6 @@
 //    [self clear];
 }
 
-
-#ifdef SCANNER_ORDER
 -(NSMutableDictionary*) convertScanitem :(NSMutableDictionary*) itemjson
 {
     
@@ -3462,6 +3514,7 @@
     NSString *orderdir = [OLDataProvider getScanPath];
     
     
+    NSDictionary* price_group=[RADataProvider get_price_group:appDelegate.price_group];
     
 //        NSString *ordercontrol = [orderdir stringByAppendingPathComponent:@"order_control.json"];
     NSString *orderPath = [orderdir stringByAppendingPathComponent:@"order.json"];
@@ -3470,6 +3523,29 @@
     if(newmodel)
         saveorder[@"section_0"]=newmodel;
     
+    NSMutableDictionary* cart_section = [saveorder[@"section_0"] mutableCopy];
+    for(int ci=0;ci<[cart_section[@"count"] intValue];ci++ )
+    {
+        NSMutableDictionary* item = [cart_section[[NSString stringWithFormat:@"item_%d",ci]] mutableCopy];
+        if(RASingleton.sharedInstance.price_type==0)
+        {
+            item[@"pg_price_type"] =price_group[@"price_0"];
+        }
+        else if([item[@"net_price"] boolValue])
+        {
+            item[@"pg_price_type"] =price_group[@"price_3"];
+        }
+        else if([item[@"special_price"] boolValue])
+        {
+            item[@"pg_price_type"] =price_group[@"price_2"];
+        }
+        else
+        {
+            item[@"pg_price_type"] =price_group[@"price_1"];
+        }
+        cart_section[[NSString stringWithFormat:@"item_%d",ci]] = item;
+    }
+    saveorder[@"section_0"] = cart_section;
         
 //        [RAUtils dicttofile:ordercontrol dict:self.content_data_control];
     [RAUtils dicttofile:orderPath dict:saveorder];
@@ -3552,6 +3628,31 @@
     
     if(newmodel)
         savecart[@"section_0"]=newmodel;
+    
+//    NSMutableDictionary*
+    cart_section = [savecart[@"section_0"] mutableCopy];
+    for(int ci=0;ci<[cart_section[@"count"] intValue];ci++ )
+    {
+        NSMutableDictionary* item = [cart_section[[NSString stringWithFormat:@"item_%d",ci]] mutableCopy];
+        if(RASingleton.sharedInstance.price_type==0)
+        {
+            item[@"pg_price_type"] =price_group[@"price_0"];
+        }
+        else if([item[@"net_price"] boolValue])
+        {
+            item[@"pg_price_type"] =price_group[@"price_3"];
+        }
+        else if([item[@"special_price"] boolValue])
+        {
+            item[@"pg_price_type"] =price_group[@"price_2"];
+        }
+        else
+        {
+            item[@"pg_price_type"] =price_group[@"price_1"];
+        }
+        cart_section[[NSString stringWithFormat:@"item_%d",ci]] = item;
+    }
+    savecart[@"section_0"]=cart_section;
     [RAUtils dicttofile:cartpath dict:savecart];
     
     NSString * zippath= [orderdir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.zip",appDelegate.order_code]];
@@ -3623,7 +3724,15 @@
             @"password" : realpassword,
             @"md5":md5
                                  };
-        [RANetwork request_fastupload:[params mutableCopy] filename:fileName data:file_data url:appDelegate.uploadurl completionHandler:^(NSMutableDictionary *result) {
+//        self.btnSubmitOrder.enabled = false;
+//        NSLog(@"disable submit button");
+        
+        
+        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Order Submission" completion:^{
+            
+            [RANetwork request_fastupload:[params mutableCopy] filename:fileName data:file_data url:appDelegate.uploadurl completionHandler:^(NSMutableDictionary *result) {
+                
+                [waitalert dismissViewControllerAnimated:false completion:^{
                     int iresult = [result[@"result"] intValue];
             if(iresult == RESULT_TRUE)
             {
@@ -3642,6 +3751,7 @@
                 if(company.length==0)
                     company = upparams[@"customer_name"];
                 [OLDataProvider save2submitScanOrder:soid company:company];
+//                [OLDataProvider scanCloseOrder];
                 [appDelegate closeOrder];
                 RASingleton.sharedInstance.scan_cart = nil;
                 
@@ -3718,11 +3828,18 @@
                 self.realpassword = nil;
                 [RAUtils message_alert:@"Can not submit order, please contact administrator." title:@"Submit Order" controller:self];
             }
+                }];
+//                self.btnSubmitOrder.enabled = true;
+//                NSLog(@"enable submit button");
+                
 
+                    
                 
+            }];
+
             
         }];
-
+        
 
         
        
@@ -3811,7 +3928,7 @@
                         
                         //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
                         
-                        DebugLog(@"EditModelPriceViewController present.........");
+                        DebugLog(@"StockViewController present.........");
                         
                         //   self.btop = false;
                         //  <#code#>

+ 2 - 0
RedAnt ERP Mobile/common/NotificationNameCenter.m

@@ -25,6 +25,8 @@ const NSString  *User_LoginOK_Notification = @"User_LoginOK_Notification";
 
 const NSString  *RA_NOTIFICATION_REFRESH_UI = @"RA_NOTIFICATION_REFRESH_UI";
 const NSString  *RA_NOTIFICATION_RELOAD_DATA = @"RA_NOTIFICATION_RELOAD_DATA";
+
+const NSString  *RA_NOTIFICATION_CART_REFRESH = @"RA_NOTIFICATION_CART_REFRESH";
 //const NSString  *RA_NOTIFICATION_SHOW_PRICE = @"RA_NOTIFICATION_SHOW_PRICE";
 //const NSString  *RA_NOTIFICATION_HIDE_PRICE = @"RA_NOTIFICATION_HIDE_PRICE";
 const NSString  *RA_NOTIFICATION_UPDATE_PRICE = @"RA_NOTIFICATION_UPDATE_PRICE";

+ 1 - 1
RedAnt ERP Mobile/common/RASingleton.h

@@ -42,7 +42,7 @@ typedef enum {
 //@property bool enable_OfflineOrder; // 离线订单开关
 @property (nonatomic,strong) NSMutableDictionary *scan_cart;///<购物车
 @property (nonatomic,strong) NSMutableArray *scan_list;///<购物车
-@property (nonatomic,strong) NSString *scan_temp_code;///<扫码订单创建前的零时单号
+//@property (nonatomic,strong) NSString *scan_temp_code;///<扫码订单创建前的零时单号
 //@property int price_index; //qr code 里的价格位置
 @property int price_type; //当前设置的价格类型
 ///

+ 9 - 0
RedAnt ERP Mobile/common/data_provider/RADataProvider.h

@@ -23,15 +23,24 @@ NS_ASSUME_NONNULL_BEGIN
 +(void)request_scan_server:(resultHandler)result;
 +(void)request_scan_news:(resultHandler)result;
 +(void)request_scan_stock:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
++(void)request_autocomplete:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
+//+(void)request_scan_cid:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
+//+(void)request_scan_shipto_company:(NSMutableDictionary*)param completionHandler:(resultHandler)result;
 +(void)request_sign_up:user email:(NSString*)email password:(NSString*) pwd completionHandler:(resultHandler)result;
 +(void)request_validate_scan_server:(NSString*)url name:(NSString*)name password:(NSString*)password completionHandler:(resultHandler)result;
 +(NSString*)getSiteName;
++(bool)getSiteHasERP;
 +(void)request_change_password:(NSString*) pwd completionHandler:(resultHandler)result;
 +(void)load_scan_models;
 +(NSArray*)request_scan_model_by_names:(NSString*)names;
 +(void) updateTemplate:(UIViewController*) vc;
 //+(void)encrypt_scan_models;
 +(bool) scanRtime:(NSString* )rtime;
+
+
++(void)default_price_group;
++(NSDictionary*)get_price_group:(NSString*) groupname;
++(NSMutableDictionary*)all_price_group;
 @end
 
 NS_ASSUME_NONNULL_END

+ 152 - 8
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -143,7 +143,7 @@
 //    2022-07-14。1.17
     //    2022-07-14。1.19
     
-NSDate * ddate =[dateFormatter dateFromString:@"2022-07-23"];
+NSDate * ddate =[dateFormatter dateFromString:@"2022-07-27"];
     
 //    bool review=[cdate earlierDate:ddate];
     NSTimeInterval secondsInterval= [cdate timeIntervalSinceDate:ddate];
@@ -236,7 +236,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2022-07-23"];
                                     
                                     
                                     [RADataProvider load_scan_models];
-                                    
+                                    [RADataProvider default_price_group];
         //                            [self loadTemplate];
                                     
                                     
@@ -344,16 +344,101 @@ NSDate * ddate =[dateFormatter dateFromString:@"2022-07-23"];
     appDelegate.scan_model = of;
     appDelegate.scan_model_key=keysort;
     
-    NSString* templatefile1 = [unZipTo stringByAppendingPathComponent:@"price_name.json"];
+//    NSString* templatefile1 = [unZipTo stringByAppendingPathComponent:@"price_name.json"];
+//    
+//    NSString* str1 = [NSString stringWithContentsOfFile:templatefile1 encoding:NSUTF8StringEncoding error:nil];
+//  
+//    NSMutableDictionary* pn = [[RAConvertor string2dict:str1] mutableCopy];
+//    
+//    appDelegate.price0_name=pn[@"price_0"];
+//    appDelegate.price1_name=pn[@"price_1"];
+//    appDelegate.price2_name=pn[@"price_2"];
+//    appDelegate.price3_name=pn[@"price_3"];
+    
+    
+}
+
++(NSMutableDictionary*)all_price_group
+{
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *documents = [paths objectAtIndex:0];
+    NSString* unZipTo=[documents stringByAppendingPathComponent:@"download"];
+
+    AppDelegate *appDelegate = nil;
+    
+    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+
+    
+    NSString* templatefile1 = [unZipTo stringByAppendingPathComponent:@"offline_price_group.json"];
     
     NSString* str1 = [NSString stringWithContentsOfFile:templatefile1 encoding:NSUTF8StringEncoding error:nil];
   
-    NSMutableDictionary* pn = [[RAConvertor string2dict:str1] mutableCopy];
+    NSMutableDictionary* pg = [[RAConvertor string2dict:str1] mutableCopy];
+    return pg;
+}
+
++(NSDictionary*)get_price_group:(NSString*) groupname
+{
+    NSMutableDictionary* pg = [self all_price_group];
+   
+    return pg[groupname];
+}
++(void)default_price_group
+{
+    
+    AppDelegate *appDelegate = nil;
+    
+    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    
+    // 如果用户有设置价格组,则默认为第一个,如果没有设置,则用服务器设置的默认价格组。
+    if(appDelegate.available_price_group.count!=0)
+    {
+        appDelegate.price_group=nil;
+        
+        
+        // 账号price group 要检查合法性
+        for(int i=0;i<appDelegate.available_price_group.count;i++)
+        {
+            if([self all_price_group][appDelegate.available_price_group[i]]!=nil)
+            {
+                appDelegate.price_group= appDelegate.available_price_group[i];
+                return;
+            }
+        }
+        
+        //如果账号的price group 全部非法,则用默认价格组。
+//        if(appDelegate.price_group==nil)
+        {
+            NSMutableDictionary* pg = [self all_price_group];
+            appDelegate.price_group=pg[@"default"];
+        }
+       
+    }
+    else
+    {
+        
+//        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//        NSString *documents = [paths objectAtIndex:0];
+//        NSString* unZipTo=[documents stringByAppendingPathComponent:@"download"];
+//
+//
+//
+//
+//
+//        NSString* templatefile1 = [unZipTo stringByAppendingPathComponent:@"price_group.json"];
+//
+//        NSString* str1 = [NSString stringWithContentsOfFile:templatefile1 encoding:NSUTF8StringEncoding error:nil];
+//
+//        NSMutableDictionary* pg = [[RAConvertor string2dict:str1] mutableCopy];
+//
+        NSMutableDictionary* pg = [self all_price_group];
+        appDelegate.price_group=pg[@"default"];
+      
+    }
+    
     
-    appDelegate.price0_name=pn[@"price_0"];
-    appDelegate.price1_name=pn[@"price_1"];
-    appDelegate.price2_name=pn[@"price_2"];
-    appDelegate.price3_name=pn[@"price_3"];
     
     
 }
@@ -419,6 +504,57 @@ NSDate * ddate =[dateFormatter dateFromString:@"2022-07-23"];
     param[@"site_name"]=[RADataProvider getSiteName];
     [self request_interface:url parameters:param err_record_url:nil completionHandler:result retry:0];
 }
++(void)request_autocomplete:(NSMutableDictionary*)param completionHandler:(resultHandler)result
+{
+        param[@"site_name"]=[self getSiteName];
+//        param[@"_method"]=@"customerID";
+        AppDelegate *appDelegate = nil;
+    
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+        
+    
+    
+    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSString* full_url ;
+    if([param[@"full_url"] boolValue])
+        full_url =param[@"url"];
+    else
+    {
+            if(appDelegate.address==nil||[param[@"url"] stringValue].length==0)
+            {
+                NSMutableDictionary* ret=[[NSMutableDictionary alloc]init];
+                ret[@"result"]=@"8";
+                ret[@"err_msg"]=@"Missing query url, please contact administrator.";
+            }
+            full_url = [appDelegate.address stringByAppendingPathComponent:[param[@"url"] stringValue]];
+    }
+
+    
+   
+    
+        [self request_interface:full_url parameters:param err_record_url:nil completionHandler:result retry:0];
+}
+//+(void)request_scan_cid:(NSMutableDictionary*)param url:(NSString*) url completionHandler:(resultHandler)result
+//{
+//    param[@"site_name"]=[self getSiteName];
+//    param[@"_method"]=@"customerID";
+//    AppDelegate *appDelegate = nil;
+//
+//    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    NSString* full_url = [appDelegate.address stringByAppendingPathComponent:url];
+//    [self request_interface:full_url parameters:param err_record_url:nil completionHandler:result retry:0];
+//}
+//+(void)request_scan_shipto_company:(NSMutableDictionary*)param url:(NSString*) url completionHandler:(resultHandler)result
+//{
+//    param[@"site_name"]=[self getSiteName];
+//    param[@"_method"]=@"shiptoCompany";
+//    AppDelegate *appDelegate = nil;
+//
+//    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    NSString* full_url = [appDelegate.address stringByAppendingPathComponent:url];
+//    [self request_interface:full_url parameters:param err_record_url:nil completionHandler:result retry:0];
+//}
+
 
 +(void)request_scan_stock:(NSMutableDictionary*)param completionHandler:(resultHandler)result
 {
@@ -470,6 +606,14 @@ NSDate * ddate =[dateFormatter dateFromString:@"2022-07-23"];
     }
     return @"";
 }
++(bool)getSiteHasERP
+{
+    NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];;
+    if (addressDic) {
+        return [addressDic[@"has_erp_site"] boolValue];
+    }
+    return false;
+}
 #endif
 +(void)request_change_password:(NSString*) pwd completionHandler:(resultHandler)result
 {

+ 3 - 0
RedAnt ERP Mobile/common/data_provider/RANetwork.h

@@ -277,4 +277,7 @@ extern NSString *const ScreenCodeOfflineSync;
 +(void)request_order_discount:(double)discount completionHandler:(resultHandler)result;
 
 +(int)parse_logininfo : (NSMutableDictionary *) jsobj user:(NSString*) user password:(NSString*) password;
+
+
++(void) request_scan_bulkdiscount:(float) discount notes:(NSString*) notes completionHandler:(resultHandler)result;
 @end

+ 43 - 1
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -10,7 +10,9 @@
 #import "RAUtils.h"
 
 #import "RASingleton.h"
+#ifdef GOOGLE_ANALYTICS
 #import "GoogleAnalyst.h"
+#endif
 #import "ERPUtils.h"
 #import "RAConvertor.h"
 #import "ActiveViewController.h"
@@ -5471,7 +5473,10 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
         appDelegate.bLogin = true;
         appDelegate.customer_type = [[objheader valueForKey:@"customer_login_type"] intValue];
         
-        
+#ifdef SCANNER_ORDER
+        appDelegate.available_price_group = objheader[@"price_group"];
+        [RADataProvider default_price_group];
+#endif
         
         if(appDelegate.user_type==USER_ROLE_CUSTOMER)
         {
@@ -10388,6 +10393,43 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
     //        return nil;
     
 }
++(void) request_scan_bulkdiscount:(float) discount notes:(NSString*) notes completionHandler:(resultHandler)result
+{
+//        appDelegate.cart_count = [[RASingleton.sharedInstance.scan_cart valueForKey:@"cart_count"] intValue];
+//
+//
+//        [appDelegate update_count_mark];
+NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0"] mutableCopy];
+    int count = [section[@"count"] intValue];
+    for(int i=0;i<count;i++)
+    {
+        NSMutableDictionary* item = [section[[NSString stringWithFormat:@"item_%d",i]] mutableCopy];
+            if ([item[@"special_price"] boolValue]||[item[@"net_price"] boolValue])
+                continue;
+        int item_count = [item[@"count"] intValue];
+        float price=[item[@"unit_price"] floatValue] ;
+        item[@"discount"] =@(discount);
+        item[@"subtotal_price"] =@(price*item_count);
+        if(discount>0)
+            item[@"note"] =[NSString stringWithFormat:@"Note: discount %d%% off.",(int)discount];
+        else
+            item[@"note"] =@"";
+        section[[NSString stringWithFormat:@"item_%d",i]] = item;
+        
+    }
+    RASingleton.sharedInstance.scan_cart[@"section_0"] = section;
+    [OLDataProvider saveScanCart:RASingleton.sharedInstance.scan_cart];
+    result(RASingleton.sharedInstance.scan_cart);
+    AppDelegate *appDelegate = nil;
+    
+    
+    
+    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    [OLDataProvider updateScanOrder:appDelegate.order_code];
+    return;
+}
+
 +(void) request_update_cart_modelprice:(NSString*) cart_id price:(float) price discount:(float) discount notes:(NSString*) notes completionHandler:(resultHandler)result
 {
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];

+ 0 - 6
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/project.pbxproj

@@ -62,7 +62,6 @@
 		3C69618323C7156D0075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617F23C7156D0075172A /* WebViewController.m */; };
 		3C69618423C7156D0075172A /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C69618023C7156D0075172A /* wkweb.storyboard */; };
 		3C7E5A8E237BDB0C006D0105 /* PortfolioListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7E5A8C237BDB0C006D0105 /* PortfolioListViewController.m */; };
-		3C872A232797F1C800BE1FC8 /* OLOSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C872A202797F1C800BE1FC8 /* OLOSettingViewController.m */; };
 		3C872A242797F1C800BE1FC8 /* scan_cart.json in Resources */ = {isa = PBXBuildFile; fileRef = 3C872A212797F1C800BE1FC8 /* scan_cart.json */; };
 		3C88559827E1D233005DC3FA /* RAUploadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C88559027E1D233005DC3FA /* RAUploadOperation.m */; };
 		3C88559927E1D233005DC3FA /* RAUploadListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C88559227E1D233005DC3FA /* RAUploadListViewController.m */; };
@@ -406,9 +405,7 @@
 		3C69618123C7156D0075172A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
 		3C7E5A8C237BDB0C006D0105 /* PortfolioListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListViewController.m; path = common/Functions/portfolio/PortfolioListViewController.m; sourceTree = SOURCE_ROOT; };
 		3C7E5A8D237BDB0C006D0105 /* PortfolioListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListViewController.h; path = common/Functions/portfolio/PortfolioListViewController.h; sourceTree = SOURCE_ROOT; };
-		3C872A202797F1C800BE1FC8 /* OLOSettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OLOSettingViewController.m; path = common/Functions/OLO/OLOSettingViewController.m; sourceTree = SOURCE_ROOT; };
 		3C872A212797F1C800BE1FC8 /* scan_cart.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = scan_cart.json; path = common/Functions/OLO/scan_cart.json; sourceTree = SOURCE_ROOT; };
-		3C872A222797F1C800BE1FC8 /* OLOSettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OLOSettingViewController.h; path = common/Functions/OLO/OLOSettingViewController.h; sourceTree = SOURCE_ROOT; };
 		3C88559027E1D233005DC3FA /* RAUploadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAUploadOperation.m; sourceTree = "<group>"; };
 		3C88559127E1D233005DC3FA /* RAUploadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAUploadManager.h; sourceTree = "<group>"; };
 		3C88559227E1D233005DC3FA /* RAUploadListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAUploadListViewController.m; sourceTree = "<group>"; };
@@ -973,8 +970,6 @@
 		3C872A1F2797F1AD00BE1FC8 /* Scaner Order */ = {
 			isa = PBXGroup;
 			children = (
-				3C872A222797F1C800BE1FC8 /* OLOSettingViewController.h */,
-				3C872A202797F1C800BE1FC8 /* OLOSettingViewController.m */,
 				3C872A212797F1C800BE1FC8 /* scan_cart.json */,
 			);
 			name = "Scaner Order";
@@ -2254,7 +2249,6 @@
 				71C1D8541F456D2700CEA1C9 /* ModelDescriptionController.m in Sources */,
 				7143E212202FCF7600451903 /* CategoryCellNPD.m in Sources */,
 				7141DD541C57459B00F7DF59 /* rscode.c in Sources */,
-				3C872A232797F1C800BE1FC8 /* OLOSettingViewController.m in Sources */,
 				7162A5E01C5876E300AB630E /* SettingViewController.m in Sources */,
 				712AFEDB1DBA050200254965 /* LineDrawable.m in Sources */,
 				71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */,

+ 1 - 1
RedAnt ERP Mobile/iSales-CONTRAST.xcodeproj/xcuserdata/ruizhang.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
 		<key>iSales-CONTRAST.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>2</integer>
+			<integer>5</integer>
 		</dict>
 		<key>iSales-USAI.xcscheme_^#shared#^_</key>
 		<dict>

+ 0 - 6
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -76,7 +76,6 @@
 		3CC7E72E23BEDA5000BE5561 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E72B23BEDA4F00BE5561 /* WebViewController.m */; };
 		3CC7E72F23BEDA5000BE5561 /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E72C23BEDA4F00BE5561 /* RAPDFViewController.m */; };
 		3CC7E73123BEDA7B00BE5561 /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC7E73023BEDA7B00BE5561 /* wkweb.storyboard */; };
-		3CF8CEBB27A0D4920094A6CD /* OLOSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CF8CEB927A0D4920094A6CD /* OLOSettingViewController.m */; };
 		423A4ADC1D503A53005ECE4A /* createContact.json in Resources */ = {isa = PBXBuildFile; fileRef = 423A4ADB1D503A53005ECE4A /* createContact.json */; };
 		423B49EF1DAC8071004181C2 /* CUL.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 423B49EE1DAC8071004181C2 /* CUL.storyboard */; };
 		424A02D11FFB3A0B0088DC56 /* RABackOrderSubmitAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 424A02D01FFB3A0B0088DC56 /* RABackOrderSubmitAlertController.m */; };
@@ -429,8 +428,6 @@
 		3CC7E72C23BEDA4F00BE5561 /* RAPDFViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAPDFViewController.m; path = "../../common/WK PDF+Web/RAPDFViewController.m"; sourceTree = "<group>"; };
 		3CC7E72D23BEDA4F00BE5561 /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
 		3CC7E73023BEDA7B00BE5561 /* wkweb.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = wkweb.storyboard; path = "../../common/WK PDF+Web/wkweb.storyboard"; sourceTree = "<group>"; };
-		3CF8CEB927A0D4920094A6CD /* OLOSettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OLOSettingViewController.m; path = common/Functions/OLO/OLOSettingViewController.m; sourceTree = SOURCE_ROOT; };
-		3CF8CEBA27A0D4920094A6CD /* OLOSettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OLOSettingViewController.h; path = common/Functions/OLO/OLOSettingViewController.h; sourceTree = SOURCE_ROOT; };
 		423A4ADB1D503A53005ECE4A /* createContact.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = createContact.json; sourceTree = "<group>"; };
 		423B49EE1DAC8071004181C2 /* CUL.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = CUL.storyboard; sourceTree = "<group>"; };
 		424A02CF1FFB3A0B0088DC56 /* RABackOrderSubmitAlertController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RABackOrderSubmitAlertController.h; path = common/Functions/order/RABackOrderSubmitAlertController.h; sourceTree = SOURCE_ROOT; };
@@ -981,8 +978,6 @@
 		3CF8CEB827A0D4740094A6CD /* SCAN_ORDER */ = {
 			isa = PBXGroup;
 			children = (
-				3CF8CEBA27A0D4920094A6CD /* OLOSettingViewController.h */,
-				3CF8CEB927A0D4920094A6CD /* OLOSettingViewController.m */,
 			);
 			name = SCAN_ORDER;
 			sourceTree = "<group>";
@@ -2312,7 +2307,6 @@
 				7162A54B1C58719D00AB630E /* RAViewController.m in Sources */,
 				71BBA2411CEAEF0700C91DED /* mztools.c in Sources */,
 				7162A59C1C58733400AB630E /* OrderDetailPriceCell.m in Sources */,
-				3CF8CEBB27A0D4920094A6CD /* OLOSettingViewController.m in Sources */,
 				3C3E26B027CDF83300EF6F5C /* RAUploadOperation.m in Sources */,
 				715850461CF6F0E500856B20 /* DefaultAppearance.m in Sources */,
 				4295AE1C1FE74D46007BE365 /* CommonEditorAutoCompleteView.m in Sources */,

+ 38 - 11
RedAnt ERP Mobile/iSales-NPD/Base.lproj/OLM.storyboard

@@ -2,7 +2,6 @@
 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
     <device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
-        <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -301,7 +300,7 @@
                                                     <rect key="frame" x="10" y="32" width="21" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <state key="normal" image="button:hrK-DY-RbO:image"/>
-                                                    <state key="selected" image="1EF24CC2-21BA-4F23-9223-180D96119692"/>
+                                                    <state key="selected" image="260A0786-78BD-4E41-A491-0E35A0615F0D"/>
                                                     <connections>
                                                         <action selector="checkButtonClick:" destination="XXr-fU-67o" eventType="touchUpInside" id="KeU-ld-H4J"/>
                                                     </connections>
@@ -844,6 +843,12 @@
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Price Group" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xvn-bA-km7">
+                                <rect key="frame" x="30" y="297" width="102" height="22"/>
+                                <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TJI-TK-yrX">
                                 <rect key="frame" x="668" y="235" width="70" height="31"/>
                                 <state key="normal" title="Button"/>
@@ -867,6 +872,12 @@
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Price group does not set" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bSV-E3-6Kl">
+                                <rect key="frame" x="30" y="339" width="187" height="21"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                             <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unlock Code" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TQb-CN-2tn">
                                 <rect key="frame" x="30" y="640" width="110" height="22"/>
                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
@@ -880,19 +891,19 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Upload Setting" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zhm-2h-vLW">
-                                <rect key="frame" x="30" y="297" width="128.5" height="21"/>
+                                <rect key="frame" x="30" y="461" width="128.5" height="21"/>
                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Max Retry Count" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ao6-r1-uXr">
-                                <rect key="frame" x="30" y="338" width="127.5" height="20.5"/>
+                                <rect key="frame" x="30" y="502" width="127.5" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField hidden="YES" opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Rj3-QR-Agk">
-                                <rect key="frame" x="688" y="331.5" width="50" height="34"/>
+                                <rect key="frame" x="688" y="495.5" width="50" height="34"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="50" id="vR6-EP-Mmm"/>
                                 </constraints>
@@ -903,13 +914,13 @@
                                 </connections>
                             </textField>
                             <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Retry Wait TimeInterval" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bt3-RG-tEN">
-                                <rect key="frame" x="30" y="378.5" width="177" height="20.5"/>
+                                <rect key="frame" x="30" y="542.5" width="177" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField hidden="YES" opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="yzC-7l-hc0">
-                                <rect key="frame" x="688" y="372" width="50" height="34"/>
+                                <rect key="frame" x="688" y="536" width="50" height="34"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="50" id="XIG-Hs-C1i"/>
                                 </constraints>
@@ -936,13 +947,13 @@
                                 </connections>
                             </button>
                             <switch hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tKv-XG-Ugr">
-                                <rect key="frame" x="689" y="414" width="51" height="31"/>
+                                <rect key="frame" x="689" y="578" width="51" height="31"/>
                                 <connections>
                                     <action selector="onAutoUpload:" destination="4E6-80-nis" eventType="valueChanged" id="9a0-gt-v8G"/>
                                 </connections>
                             </switch>
                             <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Auto Start Upload" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vel-ZT-H2H">
-                                <rect key="frame" x="30" y="419" width="136" height="20.5"/>
+                                <rect key="frame" x="30" y="583" width="136" height="20.5"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
@@ -963,6 +974,14 @@
                                     <action selector="onDeleteAccountClick:" destination="4E6-80-nis" eventType="touchUpInside" id="2Ft-3g-0MI"/>
                                 </connections>
                             </button>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="veN-AT-j6e">
+                                <rect key="frame" x="692" y="334" width="46" height="31"/>
+                                <state key="normal" title="Button"/>
+                                <buttonConfiguration key="configuration" style="plain" title="Set"/>
+                                <connections>
+                                    <action selector="onSetPriceGroup:" destination="4E6-80-nis" eventType="touchUpInside" id="nMX-8I-sl9"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
@@ -971,12 +990,14 @@
                             <constraint firstItem="3vw-sE-OsA" firstAttribute="trailing" secondItem="tKv-XG-Ugr" secondAttribute="trailing" id="2qA-D9-mfJ"/>
                             <constraint firstItem="nFJ-HW-wWn" firstAttribute="centerY" secondItem="pjl-GE-L5s" secondAttribute="centerY" id="3DR-8Q-Axe"/>
                             <constraint firstItem="R0K-zW-L9z" firstAttribute="leading" secondItem="7d3-Km-gpZ" secondAttribute="leadingMargin" constant="10" id="4v2-eO-gar"/>
+                            <constraint firstItem="bSV-E3-6Kl" firstAttribute="leading" secondItem="Xvn-bA-km7" secondAttribute="leading" id="6Sa-Bg-YcR"/>
                             <constraint firstItem="bt3-RG-tEN" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="8G9-nm-TnI"/>
                             <constraint firstItem="TQb-CN-2tn" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="8a7-Qp-xjJ"/>
                             <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="yuq-p9-cMU" secondAttribute="trailing" constant="20" symbolic="YES" id="AOj-cR-SdM"/>
                             <constraint firstItem="Obj-1G-kcW" firstAttribute="leading" secondItem="yuq-p9-cMU" secondAttribute="leading" id="Bn2-8S-64c"/>
                             <constraint firstItem="TJI-TK-yrX" firstAttribute="centerY" secondItem="Obj-1G-kcW" secondAttribute="centerY" id="EXA-Sq-gml"/>
                             <constraint firstItem="pjl-GE-L5s" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="FVr-34-x7y"/>
+                            <constraint firstItem="veN-AT-j6e" firstAttribute="trailing" secondItem="3vw-sE-OsA" secondAttribute="trailing" id="HEf-Tu-qFb"/>
                             <constraint firstItem="R0K-zW-L9z" firstAttribute="top" secondItem="auC-0B-URb" secondAttribute="bottom" constant="36" id="HFw-4H-pIJ"/>
                             <constraint firstItem="Vel-ZT-H2H" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="HQS-3n-bCN"/>
                             <constraint firstItem="TJI-TK-yrX" firstAttribute="trailing" secondItem="3vw-sE-OsA" secondAttribute="trailing" id="HRD-fh-HR7"/>
@@ -984,12 +1005,15 @@
                             <constraint firstItem="3vw-sE-OsA" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="R0K-zW-L9z" secondAttribute="trailing" constant="8" symbolic="YES" id="M1R-Ft-RMd"/>
                             <constraint firstItem="ao6-r1-uXr" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="Mdq-Ji-FxD"/>
                             <constraint firstItem="TJI-TK-yrX" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Obj-1G-kcW" secondAttribute="trailing" constant="8" symbolic="YES" id="P60-Yg-CB1"/>
-                            <constraint firstItem="zhm-2h-vLW" firstAttribute="top" secondItem="Obj-1G-kcW" secondAttribute="bottom" constant="36" id="QCw-tU-FSW"/>
+                            <constraint firstItem="zhm-2h-vLW" firstAttribute="top" secondItem="Obj-1G-kcW" secondAttribute="bottom" constant="200" id="QCw-tU-FSW"/>
+                            <constraint firstItem="Xvn-bA-km7" firstAttribute="top" secondItem="Obj-1G-kcW" secondAttribute="bottom" constant="36" id="QTy-BO-nXN"/>
                             <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="I4e-nd-eUd" secondAttribute="trailing" constant="20" symbolic="YES" id="Quu-V1-6oq"/>
                             <constraint firstItem="I4e-nd-eUd" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="TFg-oq-D04"/>
                             <constraint firstItem="Obj-1G-kcW" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="U5C-06-qZ9"/>
                             <constraint firstItem="BqX-sY-rTI" firstAttribute="top" secondItem="SRC-EL-dQp" secondAttribute="bottom" constant="36" id="UZd-w1-DlX"/>
+                            <constraint firstItem="veN-AT-j6e" firstAttribute="centerY" secondItem="bSV-E3-6Kl" secondAttribute="centerY" id="WQ2-PA-661"/>
                             <constraint firstItem="yuq-p9-cMU" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="X1e-lJ-bkm"/>
+                            <constraint firstItem="bSV-E3-6Kl" firstAttribute="top" secondItem="Xvn-bA-km7" secondAttribute="bottom" constant="20" id="Xnd-6C-RgU"/>
                             <constraint firstItem="ao6-r1-uXr" firstAttribute="top" secondItem="zhm-2h-vLW" secondAttribute="bottom" constant="20" id="YLl-pj-Cd7"/>
                             <constraint firstItem="i1w-0J-KZf" firstAttribute="leading" secondItem="R0K-zW-L9z" secondAttribute="leading" id="ZUW-IV-Lwd"/>
                             <constraint firstItem="Rj3-QR-Agk" firstAttribute="centerY" secondItem="ao6-r1-uXr" secondAttribute="centerY" id="ZyE-8y-M9t"/>
@@ -1009,6 +1033,7 @@
                             <constraint firstItem="Obj-1G-kcW" firstAttribute="top" secondItem="yuq-p9-cMU" secondAttribute="bottom" constant="20" id="mz2-QM-vNd"/>
                             <constraint firstItem="3vw-sE-OsA" firstAttribute="trailing" secondItem="i1w-0J-KZf" secondAttribute="trailing" id="neN-ot-wfg"/>
                             <constraint firstItem="zhm-2h-vLW" firstAttribute="leading" secondItem="TQb-CN-2tn" secondAttribute="leading" id="ogE-Y1-fHv"/>
+                            <constraint firstItem="Xvn-bA-km7" firstAttribute="leading" secondItem="yuq-p9-cMU" secondAttribute="leading" id="oze-Sv-irq"/>
                             <constraint firstItem="OM7-ch-z2g" firstAttribute="leading" secondItem="BqX-sY-rTI" secondAttribute="trailing" constant="48" id="qFU-BW-R9Y"/>
                             <constraint firstItem="i1w-0J-KZf" firstAttribute="top" secondItem="I4e-nd-eUd" secondAttribute="bottom" constant="10" id="qfP-6Q-JBd"/>
                             <constraint firstAttribute="trailingMargin" secondItem="3vw-sE-OsA" secondAttribute="trailing" constant="10" id="rDV-kc-ko1"/>
@@ -1022,7 +1047,9 @@
                     </view>
                     <connections>
                         <outlet property="autoSwitch" destination="tKv-XG-Ugr" id="2ty-AC-KoQ"/>
+                        <outlet property="btnSetPriceGroup" destination="veN-AT-j6e" id="s5f-zt-AVT"/>
                         <outlet property="btnSetServer" destination="3vw-sE-OsA" id="yRg-7s-xXh"/>
+                        <outlet property="labelPriceGroup" destination="bSV-E3-6Kl" id="dgq-9V-UhN"/>
                         <outlet property="labelUpdate" destination="Obj-1G-kcW" id="hgR-GJ-jxc"/>
                         <outlet property="nameTextField" destination="i1w-0J-KZf" id="Wp0-8i-mDx"/>
                         <outlet property="retryCountBox" destination="Rj3-QR-Agk" id="DLa-KS-G1a"/>
@@ -1091,7 +1118,7 @@
         </scene>
     </scenes>
     <resources>
-        <image name="1EF24CC2-21BA-4F23-9223-180D96119692" width="24" height="24">
+        <image name="260A0786-78BD-4E41-A491-0E35A0615F0D" width="24" height="24">
             <mutableData key="keyedArchiveRepresentation">
 YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T
 S2V5ZWRBcmNoaXZlctEICVRyb290gAGuCwwZGh8UJCkqMTQ3PUBVJG51bGzWDQ4PEBESExQVFhcYVk5T

+ 3 - 2
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -10,6 +10,7 @@
 #define RedAnt_ERP_Mobile_config_h
 #define BUILD_NPD
 
+#define JSON_TIMEOUT 60
 #define RA_NOTIFICATION
 //#define GOOGLE_ANALYTICS
 #define BACKORDER_PROCESS // 允许backorder process
@@ -54,7 +55,7 @@
 //------------------- chen server-----------------------
 #define  URL_BACK_ORDER_PREVIEW  @"http://192.168.0.133/pjHmlg/isales/cartDeliveryBackOrderReview.htm"
 #define  URL_MOVE_TO_BACK_ORDER @"http://192.168.0.133/pjHmlg/isales/moveToBackOrder.htm"
-
+#define URL_ORDER_DISCOUNT @""
 #define  URL_UPDATE_AUTH  @"http://192.168.0.133/pjHmlg/isales/login.htm"
 #define  URL_LOGOUT  @"http://192.168.0.133/pjHmlg/isales/loginOut.htm"
 #define  URL_RETRIEVE_PASS  @"http://192.168.0.133/pjHmlg/isales/forgotPassword.htm"
@@ -196,7 +197,7 @@
 #define  URL_UPDATE_AUTH  @"https://www.newpacificdirect.com/isales/login.htm"
 #define  URL_LOGOUT  @"https://www.newpacificdirect.com/isales/loginOut.htm"
 #define  URL_RETRIEVE_PASS  @"https://www.newpacificdirect.com/isales/forgotPassword.htm"
-
+#define URL_ORDER_DISCOUNT @""
 #define  URL_REQUEST_CATMENU  @"https://www.newpacificdirect.com/isales/menu.htm"
 #define  URL_LOAD_HOME  @"https://www.newpacificdirect.com/isales/homePage.htm"
 #define  URL_CATEGORY @"https://www.newpacificdirect.com/isales/distinctCategory.htm"

+ 12 - 0
RedAnt ERP Mobile/iSales-TRADESHOW.xcodeproj/project.pbxproj

@@ -31,6 +31,8 @@
 		3C69618A23C718150075172A /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69618523C718140075172A /* RAPDFViewController.m */; };
 		3C69618B23C718150075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69618623C718140075172A /* WebViewController.m */; };
 		3C69618C23C718150075172A /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C69618923C718150075172A /* wkweb.storyboard */; };
+		3C775816289227B100064C39 /* RAUploadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C775812289227B000064C39 /* RAUploadManager.m */; };
+		3C775817289227B100064C39 /* RAUploadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C775815289227B100064C39 /* RAUploadOperation.m */; };
 		3C7E5A84237BDAA6006D0105 /* PortfolioListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7E5A83237BDAA6006D0105 /* PortfolioListViewController.m */; };
 		3C9FFA20274795690067830C /* RASingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA1F274795690067830C /* RASingleton.m */; };
 		3C9FFA26274795C90067830C /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFA24274795C90067830C /* RAUtils.m */; };
@@ -340,6 +342,10 @@
 		3C69618723C718140075172A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
 		3C69618823C718150075172A /* RAPDFViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAPDFViewController.h; path = "../../common/WK PDF+Web/RAPDFViewController.h"; sourceTree = "<group>"; };
 		3C69618923C718150075172A /* wkweb.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = wkweb.storyboard; path = "../../common/WK PDF+Web/wkweb.storyboard"; sourceTree = "<group>"; };
+		3C775812289227B000064C39 /* RAUploadManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUploadManager.m; path = ../../common/upload/RAUploadManager.m; sourceTree = "<group>"; };
+		3C775813289227B000064C39 /* RAUploadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUploadManager.h; path = ../../common/upload/RAUploadManager.h; sourceTree = "<group>"; };
+		3C775814289227B000064C39 /* RAUploadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUploadOperation.h; path = ../../common/upload/RAUploadOperation.h; sourceTree = "<group>"; };
+		3C775815289227B100064C39 /* RAUploadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUploadOperation.m; path = ../../common/upload/RAUploadOperation.m; sourceTree = "<group>"; };
 		3C7E5A82237BDAA6006D0105 /* PortfolioListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListViewController.h; path = common/Functions/portfolio/PortfolioListViewController.h; sourceTree = SOURCE_ROOT; };
 		3C7E5A83237BDAA6006D0105 /* PortfolioListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListViewController.m; path = common/Functions/portfolio/PortfolioListViewController.m; sourceTree = SOURCE_ROOT; };
 		3C9FFA1E274795690067830C /* RASingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RASingleton.h; path = common/RASingleton.h; sourceTree = SOURCE_ROOT; };
@@ -1995,6 +2001,10 @@
 		71E9F6BD1F8B53AB0052C78E /* upload */ = {
 			isa = PBXGroup;
 			children = (
+				3C775813289227B000064C39 /* RAUploadManager.h */,
+				3C775812289227B000064C39 /* RAUploadManager.m */,
+				3C775814289227B000064C39 /* RAUploadOperation.h */,
+				3C775815289227B100064C39 /* RAUploadOperation.m */,
 			);
 			name = upload;
 			sourceTree = "<group>";
@@ -2178,6 +2188,7 @@
 				7162A5851C5872EF00AB630E /* HomeViewController.m in Sources */,
 				7162A5E31C5877CE00AB630E /* WatchListViewController.m in Sources */,
 				715001FF1D114D9100F5927F /* BundleDetailButton.m in Sources */,
+				3C775817289227B100064C39 /* RAUploadOperation.m in Sources */,
 				3C9FFA52274797460067830C /* RTLabel.m in Sources */,
 				7162A5421C58719D00AB630E /* RATreeNodeCollectionController.m in Sources */,
 				7162A5DE1C5876E300AB630E /* RetrievePassViewController.m in Sources */,
@@ -2209,6 +2220,7 @@
 				7162A5161C58704600AB630E /* BundleModelCell.m in Sources */,
 				42DC12F11F0CD98E00A4C011 /* OrderDetailPickInfoCell.m in Sources */,
 				7141DD621C5747CE00F7DF59 /* NSData+CommonCrypto.m in Sources */,
+				3C775816289227B100064C39 /* RAUploadManager.m in Sources */,
 				712AFED71DBA050200254965 /* BasicDrawable.m in Sources */,
 				71DF74891C57608F00F2789C /* RadioButton.m in Sources */,
 				7162A5DF1C5876E300AB630E /* ScannerSettingViewController.m in Sources */,

+ 12 - 1
RedAnt ERP Mobile/iSales-TRADESHOW/config.h

@@ -10,11 +10,13 @@
 #define RedAnt_ERP_Mobile_config_h
 #define BUILD_UWAVER
 #define BACKORDER_PROCESS // 允许backorder process
-
+#define JSON_TIMEOUT 60
 # ifdef DEBUG
 #define test_server
 # endif
 
+#define RA_NOTIFICATION
+
 #define exception_switch 1
 #define notifyMe_switch 1
 
@@ -48,6 +50,15 @@
 
 // http://192.168.0.133:8080/site
 // http://12.196.120.217
+
+#define URL_CHANGE_PASSWORD @""
+#define URL_SIGN_UP @""
+#define URL_DELETE_ACCOUNT @""
+#define URL_ORDER_DISCOUNT @""
+#define  URL_SERVER_LIST @""
+#define  URL_SERVER_CHECK @""
+
+
 #ifdef test_server
 
 //------------------- chen server-----------------------

+ 0 - 6
RedAnt ERP Mobile/iSales-UNITED WAVER.xcodeproj/project.pbxproj

@@ -48,7 +48,6 @@
 		3C3F4EF7276B346200B091AE /* DBUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EF6276B346200B091AE /* DBUtil.m */; };
 		3C3F4EFB276B34AD00B091AE /* RAProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3F4EFA276B34AD00B091AE /* RAProgressHUD.m */; };
 		3C623FD5237566A800780211 /* CommonEditor.iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C623FD4237566A800780211 /* CommonEditor.iPad.xib */; };
-		3C7D31F027882788005EB380 /* OLOSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7D31EF27882788005EB380 /* OLOSettingViewController.m */; };
 		3C7E5A81237BD953006D0105 /* PortfolioListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7E5A7F237BD952006D0105 /* PortfolioListViewController.m */; };
 		3C9BED082373FED40052241C /* iPadCommonEditorCellSignature.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C9BED072373FED40052241C /* iPadCommonEditorCellSignature.xib */; };
 		3C9BED0A2373FF1B0052241C /* iPadCommonEditorCellSwitch.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C9BED092373FF1B0052241C /* iPadCommonEditorCellSwitch.xib */; };
@@ -385,8 +384,6 @@
 		3C3F4EFA276B34AD00B091AE /* RAProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAProgressHUD.m; sourceTree = "<group>"; };
 		3C3F4EFC276B34F400B091AE /* common_const.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = common_const.h; path = ../../common/common_const.h; sourceTree = "<group>"; };
 		3C623FD4237566A800780211 /* CommonEditor.iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CommonEditor.iPad.xib; path = ../../common/customUI/CommonEditoriPad/CommonEditor.iPad.xib; sourceTree = "<group>"; };
-		3C7D31EE27882788005EB380 /* OLOSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OLOSettingViewController.h; path = common/Functions/OLO/OLOSettingViewController.h; sourceTree = SOURCE_ROOT; };
-		3C7D31EF27882788005EB380 /* OLOSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = OLOSettingViewController.m; path = common/Functions/OLO/OLOSettingViewController.m; sourceTree = SOURCE_ROOT; };
 		3C7E5A7F237BD952006D0105 /* PortfolioListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListViewController.m; path = common/Functions/portfolio/PortfolioListViewController.m; sourceTree = SOURCE_ROOT; };
 		3C7E5A80237BD953006D0105 /* PortfolioListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListViewController.h; path = common/Functions/portfolio/PortfolioListViewController.h; sourceTree = SOURCE_ROOT; };
 		3C9BED072373FED40052241C /* iPadCommonEditorCellSignature.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = iPadCommonEditorCellSignature.xib; path = ../../common/customUI/CommonEditoriPad/iPadCommonEditorCellSignature.xib; sourceTree = "<group>"; };
@@ -916,8 +913,6 @@
 		3C7D31ED27882722005EB380 /* OLO */ = {
 			isa = PBXGroup;
 			children = (
-				3C7D31EE27882788005EB380 /* OLOSettingViewController.h */,
-				3C7D31EF27882788005EB380 /* OLOSettingViewController.m */,
 			);
 			name = OLO;
 			sourceTree = "<group>";
@@ -2345,7 +2340,6 @@
 				7162A51A1C58704600AB630E /* ModelItemCell.m in Sources */,
 				7141DD511C57459B00F7DF59 /* qrencode.c in Sources */,
 				7162A5451C58719D00AB630E /* RATreeView.m in Sources */,
-				3C7D31F027882788005EB380 /* OLOSettingViewController.m in Sources */,
 				3C3F4EDC276B336900B091AE /* EnumSelectViewController.m in Sources */,
 				71DF74841C57608F00F2789C /* ImageScrollerViewController.m in Sources */,
 				71DF74861C57608F00F2789C /* ImageViewController.m in Sources */,

+ 0 - 6
RedAnt ERP Mobile/iSales-USAI.xcodeproj/project.pbxproj

@@ -66,7 +66,6 @@
 		3C69618223C7156D0075172A /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617E23C7156D0075172A /* RAPDFViewController.m */; };
 		3C69618323C7156D0075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617F23C7156D0075172A /* WebViewController.m */; };
 		3C69618423C7156D0075172A /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C69618023C7156D0075172A /* wkweb.storyboard */; };
-		3C7D31F427882A74005EB380 /* OLOSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7D31F327882A73005EB380 /* OLOSettingViewController.m */; };
 		3C7E5A8E237BDB0C006D0105 /* PortfolioListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7E5A8C237BDB0C006D0105 /* PortfolioListViewController.m */; };
 		3C872A1E27955CF300BE1FC8 /* scan_cart.json in Resources */ = {isa = PBXBuildFile; fileRef = 3C872A1D27955CF300BE1FC8 /* scan_cart.json */; };
 		3C872A262797FE7C00BE1FC8 /* scan_order.json in Resources */ = {isa = PBXBuildFile; fileRef = 3C872A252797FE7C00BE1FC8 /* scan_order.json */; };
@@ -415,8 +414,6 @@
 		3C69617F23C7156D0075172A /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebViewController.m; path = "../../common/WK PDF+Web/WebViewController.m"; sourceTree = "<group>"; };
 		3C69618023C7156D0075172A /* wkweb.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = wkweb.storyboard; path = "../../common/WK PDF+Web/wkweb.storyboard"; sourceTree = "<group>"; };
 		3C69618123C7156D0075172A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
-		3C7D31F227882A73005EB380 /* OLOSettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OLOSettingViewController.h; path = common/Functions/OLO/OLOSettingViewController.h; sourceTree = SOURCE_ROOT; };
-		3C7D31F327882A73005EB380 /* OLOSettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OLOSettingViewController.m; path = common/Functions/OLO/OLOSettingViewController.m; sourceTree = SOURCE_ROOT; };
 		3C7E5A8C237BDB0C006D0105 /* PortfolioListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PortfolioListViewController.m; path = common/Functions/portfolio/PortfolioListViewController.m; sourceTree = SOURCE_ROOT; };
 		3C7E5A8D237BDB0C006D0105 /* PortfolioListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PortfolioListViewController.h; path = common/Functions/portfolio/PortfolioListViewController.h; sourceTree = SOURCE_ROOT; };
 		3C872A1D27955CF300BE1FC8 /* scan_cart.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = scan_cart.json; path = common/Functions/OLO/scan_cart.json; sourceTree = SOURCE_ROOT; };
@@ -991,8 +988,6 @@
 				3C51E7D127B2628900E61163 /* UIView+Toast.h */,
 				3C51E7D227B2628900E61163 /* UIView+Toast.m */,
 				3C51E7C127B261EC00E61163 /* upload */,
-				3C7D31F227882A73005EB380 /* OLOSettingViewController.h */,
-				3C7D31F327882A73005EB380 /* OLOSettingViewController.m */,
 				3C872A1D27955CF300BE1FC8 /* scan_cart.json */,
 				3C872A252797FE7C00BE1FC8 /* scan_order.json */,
 				3C51E7CE27B2623700E61163 /* UploadCell.h */,
@@ -2250,7 +2245,6 @@
 				71C1D8541F456D2700CEA1C9 /* ModelDescriptionController.m in Sources */,
 				7143E212202FCF7600451903 /* CategoryCellNPD.m in Sources */,
 				7141DD541C57459B00F7DF59 /* rscode.c in Sources */,
-				3C7D31F427882A74005EB380 /* OLOSettingViewController.m in Sources */,
 				7162A5E01C5876E300AB630E /* SettingViewController.m in Sources */,
 				712AFEDB1DBA050200254965 /* LineDrawable.m in Sources */,
 				71DF748B1C57608F00F2789C /* SimpleGrid.m in Sources */,

+ 86 - 85
RedAnt ERP Mobile/iSales-USAI/config.h

@@ -10,7 +10,7 @@
 #define RedAnt_ERP_Mobile_config_h
 #define BUILD_USAI
 #define BACKORDER_PROCESS // 允许backorder process
-
+#define JSON_TIMEOUT 60
 
 #define RA_NOTIFICATION
 
@@ -57,7 +57,7 @@
 #define LOCAL_URL_CUSTOMER_INFO_EDIT @"customer_info_template_edit"
 
 
-
+#define URL_ORDER_DISCOUNT @""
 // http://192.168.0.133:8080/site
 // http://12.196.120.217
 #ifdef test_server
@@ -66,6 +66,7 @@
 #define  URL_SERVER_CHECK @""
 #define  URL_CHANGE_PASSWORD @""
 #define URL_SIGN_UP @""
+
 //------------------- chen server-----------------------
 #define  URL_BACK_ORDER_PREVIEW  @"http://12.196.120.217/isales/cartDeliveryBackOrderReview.htm"
 #define  URL_MOVE_TO_BACK_ORDER @"http://12.196.120.217/isales/moveToBackOrder.htm"
@@ -212,133 +213,133 @@
 #define  URL_CHANGE_PASSWORD @""
 #define URL_SIGN_UP @""
 
-#define  URL_UPDATE_AUTH  @"https://central.united-us.com/usai_demo/shopping/isales/login.htm"
-#define  URL_LOGOUT  @"https://central.united-us.com/usai_demo/shopping/isales/loginOut.htm"
-#define  URL_RETRIEVE_PASS  @"https://central.united-us.com/usai_demo/shopping/isales/forgotPassword.htm"
+#define  URL_UPDATE_AUTH  @"https://central.kerryapex.com/usai_demo/shopping/isales/login.htm"
+#define  URL_LOGOUT  @"https://central.kerryapex.com/usai_demo/shopping/isales/loginOut.htm"
+#define  URL_RETRIEVE_PASS  @"https://central.kerryapex.com/usai_demo/shopping/isales/forgotPassword.htm"
 
-#define  URL_REQUEST_CATMENU  @"https://central.united-us.com/usai_demo/shopping/isales/menu.htm"
-#define  URL_LOAD_HOME  @"https://central.united-us.com/usai_demo/shopping/isales/homePage.htm"
-#define  URL_CATEGORY @"https://central.united-us.com/usai_demo/shopping/isales/distinctCategory.htm"
-#define  URL_SEARCH  @"https://central.united-us.com/usai_demo/shopping/isales/search.htm"
-#define  URL_ITEM_SEARCH  @"https://central.united-us.com/usai_demo/shopping/isales/itemSearch.htm"
-#define  URL_CATEGORY_LOADMORE  @"https://central.united-us.com/usai_demo/shopping/isales/categoryMore.htm"
+#define  URL_REQUEST_CATMENU  @"https://central.kerryapex.com/usai_demo/shopping/isales/menu.htm"
+#define  URL_LOAD_HOME  @"https://central.kerryapex.com/usai_demo/shopping/isales/homePage.htm"
+#define  URL_CATEGORY @"https://central.kerryapex.com/usai_demo/shopping/isales/distinctCategory.htm"
+#define  URL_SEARCH  @"https://central.kerryapex.com/usai_demo/shopping/isales/search.htm"
+#define  URL_ITEM_SEARCH  @"https://central.kerryapex.com/usai_demo/shopping/isales/itemSearch.htm"
+#define  URL_CATEGORY_LOADMORE  @"https://central.kerryapex.com/usai_demo/shopping/isales/categoryMore.htm"
 
 
-#define  URL_ORDER_LIST  @"https://central.united-us.com/usai_demo/shopping/isales/orderList.htm"
-#define  URL_ORDER_DETAIL  @"https://central.united-us.com/usai_demo/shopping/isales/orderDetail.htm"
-#define URL_COMMIT_ORDER @"https://central.united-us.com/usai_demo/shopping/isales/createOrder.htm"
-#define URL_SAVE_ORDER @"https://central.united-us.com/usai_demo/shopping/isales/saveOrder.htm"
-#define URL_UPDATE_ORDERCUSTOMER @"https://central.united-us.com/usai_demo/shopping/isales/updateOrderCustomerInfo.htm"
-#define  URL_NEW_ORDER  @"https://central.united-us.com/usai_demo/shopping/isales/createNewOrder.htm"
-#define  URL_OPEN_ORDER  @"https://central.united-us.com/usai_demo/shopping/isales/openOrder.htm"
-#define  URL_RELEASE_ORDER  @"https://central.united-us.com/usai_demo/shopping/isales/closeOrder.htm"
-#define  URL_DELETE_ORDER  @"https://central.united-us.com/usai_demo/shopping/isales/deleteOrder.htm"
-#define  URL_CANCEL_ORDER  @"https://central.united-us.com/usai_demo/shopping/isales/cancelOrder.htm"
+#define  URL_ORDER_LIST  @"https://central.kerryapex.com/usai_demo/shopping/isales/orderList.htm"
+#define  URL_ORDER_DETAIL  @"https://central.kerryapex.com/usai_demo/shopping/isales/orderDetail.htm"
+#define URL_COMMIT_ORDER @"https://central.kerryapex.com/usai_demo/shopping/isales/createOrder.htm"
+#define URL_SAVE_ORDER @"https://central.kerryapex.com/usai_demo/shopping/isales/saveOrder.htm"
+#define URL_UPDATE_ORDERCUSTOMER @"https://central.kerryapex.com/usai_demo/shopping/isales/updateOrderCustomerInfo.htm"
+#define  URL_NEW_ORDER  @"https://central.kerryapex.com/usai_demo/shopping/isales/createNewOrder.htm"
+#define  URL_OPEN_ORDER  @"https://central.kerryapex.com/usai_demo/shopping/isales/openOrder.htm"
+#define  URL_RELEASE_ORDER  @"https://central.kerryapex.com/usai_demo/shopping/isales/closeOrder.htm"
+#define  URL_DELETE_ORDER  @"https://central.kerryapex.com/usai_demo/shopping/isales/deleteOrder.htm"
+#define  URL_CANCEL_ORDER  @"https://central.kerryapex.com/usai_demo/shopping/isales/cancelOrder.htm"
 
 
-#define  URL_CART_SET_PRICE  @"https://central.united-us.com/usai_demo/shopping/isales/setPrice.htm"
-#define  URL_CART_INCRESEMENT  @"https://central.united-us.com/usai_demo/shopping/isales/increment.htm"
-#define  URL_CART  @"https://central.united-us.com/usai_demo/shopping/isales/cartDtail.htm"
-#define  URL_CARTDELIVERY  @"https://central.united-us.com/usai_demo/shopping/isales/cartDelivery.htm"
-#define  URL_ADD_TO_CART  @"https://central.united-us.com/usai_demo/shopping/isales/addToCart.htm"
-#define  URL_CART_REMOVE  @"https://central.united-us.com/usai_demo/shopping/isales/deleteToCart.htm"
-#define  URL_CART_CHECK  @"https://central.united-us.com/usai_demo/shopping/isales/checkCartItem.htm"
+#define  URL_CART_SET_PRICE  @"https://central.kerryapex.com/usai_demo/shopping/isales/setPrice.htm"
+#define  URL_CART_INCRESEMENT  @"https://central.kerryapex.com/usai_demo/shopping/isales/increment.htm"
+#define  URL_CART  @"https://central.kerryapex.com/usai_demo/shopping/isales/cartDtail.htm"
+#define  URL_CARTDELIVERY  @"https://central.kerryapex.com/usai_demo/shopping/isales/cartDelivery.htm"
+#define  URL_ADD_TO_CART  @"https://central.kerryapex.com/usai_demo/shopping/isales/addToCart.htm"
+#define  URL_CART_REMOVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/deleteToCart.htm"
+#define  URL_CART_CHECK  @"https://central.kerryapex.com/usai_demo/shopping/isales/checkCartItem.htm"
 
-#define  URL_CART2WISH  @"https://central.united-us.com/usai_demo/shopping/isales/cartRemoveToWishlist.htm"
-#define  URL_WISH2CART  @"https://central.united-us.com/usai_demo/shopping/isales/wishlistRemoveToCart.htm"
+#define  URL_CART2WISH  @"https://central.kerryapex.com/usai_demo/shopping/isales/cartRemoveToWishlist.htm"
+#define  URL_WISH2CART  @"https://central.kerryapex.com/usai_demo/shopping/isales/wishlistRemoveToCart.htm"
 
-#define  URL_ITEM_DETAIL  @"https://central.united-us.com/usai_demo/shopping/isales/modelDetail.htm"
+#define  URL_ITEM_DETAIL  @"https://central.kerryapex.com/usai_demo/shopping/isales/modelDetail.htm"
 
-#define  URL_ADD_TO_WATCHLIST  @"https://central.united-us.com/usai_demo/shopping/isales/addToWishList.htm"
-#define  URL_WATCHLIST  @"https://central.united-us.com/usai_demo/shopping/isales/wishList.htm"
-#define  URL_WATCHLIST_REMOVE  @"https://central.united-us.com/usai_demo/shopping/isales/deleteToWishList.htm"
+#define  URL_ADD_TO_WATCHLIST  @"https://central.kerryapex.com/usai_demo/shopping/isales/addToWishList.htm"
+#define  URL_WATCHLIST  @"https://central.kerryapex.com/usai_demo/shopping/isales/wishList.htm"
+#define  URL_WATCHLIST_REMOVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/deleteToWishList.htm"
 
 
 
-#define  URL_ADD_TO_PORTFOLIO @"https://central.united-us.com/usai_demo/shopping/isales/addToPortfolio.htm"
-#define  URL_PORTFOLIO_REMOVE  @"https://central.united-us.com/usai_demo/shopping/isales/deleteToPortfolio.htm"
-#define  URL_PORTFOLIO  @"https://central.united-us.com/usai_demo/shopping/isales/portfolios.htm"
-#define  URL_PORTFOLIO_SET_PRICE  @"https://central.united-us.com/usai_demo/shopping/isales/setTearSheetPrice.htm"
-#define  URL_DM_PARAMS @"https://central.united-us.com/usai_demo/shopping/isales/selectTearSheetParam.htm"
-#define  URL_REQUEST_DM @"https://central.united-us.com/usai_demo/shopping/isales/getTearSheetPdf.htm"
-#define  URL_SAVE_DM_DIRECT @"https://central.united-us.com/usai_demo/shopping/isales/getTearSheetPdf.htm"
-#define  URL_SAVE_DM @"https://central.united-us.com/usai_demo/shopping/isales/saveTearSheetPdf.htm"
-#define  URL_DM_LIST @"https://central.united-us.com/usai_demo/shopping/isales/tearSheetPdfList.htm"
-//#define  URL_DM_SET_QTY @"https://central.united-us.com/usai_demo/shopping/isales/setTearSheetAvailableQty.htm"
-#define  URL_REQUEST_MODEL_QTY @"https://central.united-us.com/usai_demo/shopping/isales/getTearSheetAvailableQty.htm"
+#define  URL_ADD_TO_PORTFOLIO @"https://central.kerryapex.com/usai_demo/shopping/isales/addToPortfolio.htm"
+#define  URL_PORTFOLIO_REMOVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/deleteToPortfolio.htm"
+#define  URL_PORTFOLIO  @"https://central.kerryapex.com/usai_demo/shopping/isales/portfolios.htm"
+#define  URL_PORTFOLIO_SET_PRICE  @"https://central.kerryapex.com/usai_demo/shopping/isales/setTearSheetPrice.htm"
+#define  URL_DM_PARAMS @"https://central.kerryapex.com/usai_demo/shopping/isales/selectTearSheetParam.htm"
+#define  URL_REQUEST_DM @"https://central.kerryapex.com/usai_demo/shopping/isales/getTearSheetPdf.htm"
+#define  URL_SAVE_DM_DIRECT @"https://central.kerryapex.com/usai_demo/shopping/isales/getTearSheetPdf.htm"
+#define  URL_SAVE_DM @"https://central.kerryapex.com/usai_demo/shopping/isales/saveTearSheetPdf.htm"
+#define  URL_DM_LIST @"https://central.kerryapex.com/usai_demo/shopping/isales/tearSheetPdfList.htm"
+//#define  URL_DM_SET_QTY @"https://central.kerryapex.com/usai_demo/shopping/isales/setTearSheetAvailableQty.htm"
+#define  URL_REQUEST_MODEL_QTY @"https://central.kerryapex.com/usai_demo/shopping/isales/getTearSheetAvailableQty.htm"
 
 
-#define  URL_CONTACT_LIST  @"https://central.united-us.com/usai_demo/shopping/isales/getAllContact.htm"
-#define  URL_SHIPTO_LIST  @"https://central.united-us.com/usai_demo/shopping/isales/getShipToContact.htm"
+#define  URL_CONTACT_LIST  @"https://central.kerryapex.com/usai_demo/shopping/isales/getAllContact.htm"
+#define  URL_SHIPTO_LIST  @"https://central.kerryapex.com/usai_demo/shopping/isales/getShipToContact.htm"
 
-#define  URL_ADDRESS_EDOTOR  @"https://central.united-us.com/usai_demo/shopping/isales/getAddAddress.htm"
-#define  URL_ADDRESS_SAVE  @"https://central.united-us.com/usai_demo/shopping/isales/saveAddress.htm"
+#define  URL_ADDRESS_EDOTOR  @"https://central.kerryapex.com/usai_demo/shopping/isales/getAddAddress.htm"
+#define  URL_ADDRESS_SAVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/saveAddress.htm"
 
 
-#define  URL_CREDITCARD_EDOTOR  @"https://central.united-us.com/usai_demo/shopping/isales/creditCard.htm"
-#define  URL_CREDITCARD_SAVE  @"https://central.united-us.com/usai_demo/shopping/isales/saveAddress.htm"
+#define  URL_CREDITCARD_EDOTOR  @"https://central.kerryapex.com/usai_demo/shopping/isales/creditCard.htm"
+#define  URL_CREDITCARD_SAVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/saveAddress.htm"
 
 
 
-#define  URL_CUSTOMER_INFO  @"https://central.united-us.com/usai_demo/shopping/isales/getCustomerInfoByContact.htm"
-#define  URL_NEW_CUSTOMER  @"https://central.united-us.com/usai_demo/shopping/isales/getAddCustomer.htm"
-#define  URL_CUSTOMER_SAVE  @"https://central.united-us.com/usai_demo/shopping/isales/saveCustomer.htm"
-#define  URL_UPDATE_CUSTOMER_BCARD  @"https://central.united-us.com/usai_demo/shopping/isales/updateCustomerBusiCard.htm"
-#define  URL_CUSTOMER_ADV_SEARCH @"https://central.united-us.com/usai_demo/shopping/isales/getContactAdvance.htm"
+#define  URL_CUSTOMER_INFO  @"https://central.kerryapex.com/usai_demo/shopping/isales/getCustomerInfoByContact.htm"
+#define  URL_NEW_CUSTOMER  @"https://central.kerryapex.com/usai_demo/shopping/isales/getAddCustomer.htm"
+#define  URL_CUSTOMER_SAVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/saveCustomer.htm"
+#define  URL_UPDATE_CUSTOMER_BCARD  @"https://central.kerryapex.com/usai_demo/shopping/isales/updateCustomerBusiCard.htm"
+#define  URL_CUSTOMER_ADV_SEARCH @"https://central.kerryapex.com/usai_demo/shopping/isales/getContactAdvance.htm"
 
 
 
 
 
-#define  URL_ERR_LOG  @"https://central.united-us.com/usai_demo/shopping/isales/er_log.htm"
+#define  URL_ERR_LOG  @"https://central.kerryapex.com/usai_demo/shopping/isales/er_log.htm"
 
-#define  URL_UPLOAD_IMG  @"https://central.united-us.com/usai_demo/shopping/isales/uploadImg.htm"
+#define  URL_UPLOAD_IMG  @"https://central.kerryapex.com/usai_demo/shopping/isales/uploadImg.htm"
 
-#define URL_COPY_ORDER @"https://central.united-us.com/usai_demo/shopping/isales/copyOrder.htm"
-#define URL_SIGN_ORDER @"https://central.united-us.com/usai_demo/shopping/isales/updateOrderSign.htm"
-#define  URL_CUSTOMER_UPDATE  @"https://central.united-us.com/usai_demo/shopping/isales/updateCustomer.htm"
-#define  URL_CART_GENERAL_NOTES  @"https://central.united-us.com/usai_demo/shopping/isales/updateGeneralNote.htm"
-#define  URL_CART_ITEM_NOTES  @"https://central.united-us.com/usai_demo/shopping/isales/setItemNotes.htm"
-#define  URL_EDIT_CUSTOMER  @"https://central.united-us.com/usai_demo/shopping/isales/getUpdateCustomerInfoByContact.htm"
-#define  URL_CUSTOMER_PENDINGORDER  @"https://central.united-us.com/usai_demo/shopping/isales/hasPendingOrderByContact.htm"
-#define  URL_PORTFOLIOLIST_REMOVE  @"https://central.united-us.com/usai_demo/shopping/isales/deleteTearSheetPdf.htm"
-#define  URL_NPD_POLICY   @"https://central.united-us.com/usai_demo/shopping/isales/generalPolicy.htm"
+#define URL_COPY_ORDER @"https://central.kerryapex.com/usai_demo/shopping/isales/copyOrder.htm"
+#define URL_SIGN_ORDER @"https://central.kerryapex.com/usai_demo/shopping/isales/updateOrderSign.htm"
+#define  URL_CUSTOMER_UPDATE  @"https://central.kerryapex.com/usai_demo/shopping/isales/updateCustomer.htm"
+#define  URL_CART_GENERAL_NOTES  @"https://central.kerryapex.com/usai_demo/shopping/isales/updateGeneralNote.htm"
+#define  URL_CART_ITEM_NOTES  @"https://central.kerryapex.com/usai_demo/shopping/isales/setItemNotes.htm"
+#define  URL_EDIT_CUSTOMER  @"https://central.kerryapex.com/usai_demo/shopping/isales/getUpdateCustomerInfoByContact.htm"
+#define  URL_CUSTOMER_PENDINGORDER  @"https://central.kerryapex.com/usai_demo/shopping/isales/hasPendingOrderByContact.htm"
+#define  URL_PORTFOLIOLIST_REMOVE  @"https://central.kerryapex.com/usai_demo/shopping/isales/deleteTearSheetPdf.htm"
+#define  URL_NPD_POLICY   @"https://central.kerryapex.com/usai_demo/shopping/isales/generalPolicy.htm"
 
 #define URL_PRIVACY @"https://uwa.united-us.net/site/isales_uwa/privacyPolicy.htm"
 
 
-#define  URL_CHECK_OFFLINE  @"https://central.united-us.com/demo/shopping/offline/initDatas.htm"
+#define  URL_CHECK_OFFLINE  @"https://central.kerryapex.com/demo/shopping/offline/initDatas.htm"
 
-#define  URL_DOWNLOAD_OFFLINE  @"https://central.united-us.com/demo/shopping/offline/downloadDatas.htm"
+#define  URL_DOWNLOAD_OFFLINE  @"https://central.kerryapex.com/demo/shopping/offline/downloadDatas.htm"
 
-#define  URL_FINISH_DOWNLOAD_OFFLINE  @"https://central.united-us.com/demo/shopping/offline/confirmVersion.htm"
-#define  URL_UPLOAD_OFFLINE  @"https://central.united-us.com/demo/shopping/offline/uploadOfflineData.htm"
+#define  URL_FINISH_DOWNLOAD_OFFLINE  @"https://central.kerryapex.com/demo/shopping/offline/confirmVersion.htm"
+#define  URL_UPLOAD_OFFLINE  @"https://central.kerryapex.com/demo/shopping/offline/uploadOfflineData.htm"
 
-#define  URL_CATEGORYADDALL  @"https://central.united-us.com/usai_demo/shopping/isales/categoryAddAllTo.htm"
-#define  URL_SEARCHADDALL  @"https://central.united-us.com/usai_demo/shopping/isales/searchAddAllTo.htm"
-#define  URL_ITEMSEARCHADDALL @"https://central.united-us.com/usai_demo/shopping/isales/itemSearchAddAllTo.htm"
+#define  URL_CATEGORYADDALL  @"https://central.kerryapex.com/usai_demo/shopping/isales/categoryAddAllTo.htm"
+#define  URL_SEARCHADDALL  @"https://central.kerryapex.com/usai_demo/shopping/isales/searchAddAllTo.htm"
+#define  URL_ITEMSEARCHADDALL @"https://central.kerryapex.com/usai_demo/shopping/isales/itemSearchAddAllTo.htm"
 
-#define URL_SET_PRICE_TYPE @"https://central.united-us.com/usai_demo/shopping/isales/setSeePriceType.htm"
+#define URL_SET_PRICE_TYPE @"https://central.kerryapex.com/usai_demo/shopping/isales/setSeePriceType.htm"
 
-#define URL_GET_CIVEN_PRICE @"https://central.united-us.com/usai_demo/shopping/isales/getSeeGivenPrice.htm"
+#define URL_GET_CIVEN_PRICE @"https://central.kerryapex.com/usai_demo/shopping/isales/getSeeGivenPrice.htm"
 
-#define URL_SET_GIVEN_PRICE @"https://central.united-us.com/usai_demo/shopping/isales/setSeeGivenPrice.htm"
+#define URL_SET_GIVEN_PRICE @"https://central.kerryapex.com/usai_demo/shopping/isales/setSeeGivenPrice.htm"
 
-#define URL_SET_MERGE_ORDER @"https://central.united-us.com/usai_demo/shopping/isales/mergeOrder.htm"
+#define URL_SET_MERGE_ORDER @"https://central.kerryapex.com/usai_demo/shopping/isales/mergeOrder.htm"
 
-#define URL_REQUEST_LOGIN @"https://central.united-us.com/usai_demo/shopping/isales/requestLogin.htm"
+#define URL_REQUEST_LOGIN @"https://central.kerryapex.com/usai_demo/shopping/isales/requestLogin.htm"
 
-#define URL_EMAIL_CART @"https://central.united-us.com/usai_demo/shopping/isales/sendCartEmail.htm"
+#define URL_EMAIL_CART @"https://central.kerryapex.com/usai_demo/shopping/isales/sendCartEmail.htm"
 
-#define URL_NOTIFY_ME @"https://central.united-us.com/usai_demo/shopping/isales/notifyMeEmail.htm"
+#define URL_NOTIFY_ME @"https://central.kerryapex.com/usai_demo/shopping/isales/notifyMeEmail.htm"
 
-#define URL_EMAIL_WISHLIST @"https://central.united-us.com/usai_demo/shopping/isales/sendWishListEmail.htm"
+#define URL_EMAIL_WISHLIST @"https://central.kerryapex.com/usai_demo/shopping/isales/sendWishListEmail.htm"
 
-#define URL_BLOG @"https://central.united-us.com/demo/shopping/blog"
+#define URL_BLOG @"https://central.kerryapex.com/demo/shopping/blog"
 
-#define  URL_MOVE_TO_BACK_ORDER @"https://central.united-us.com/usai_demo/shopping/isales/moveToBackOrder.htm"
+#define  URL_MOVE_TO_BACK_ORDER @"https://central.kerryapex.com/usai_demo/shopping/isales/moveToBackOrder.htm"
 
-#define  URL_BACK_ORDER_PREVIEW  @"https://central.united-us.com/usai_demo/shopping/isales/cartDeliveryBackOrderReview.htm"
+#define  URL_BACK_ORDER_PREVIEW  @"https://central.kerryapex.com/usai_demo/shopping/isales/cartDeliveryBackOrderReview.htm"
 
 #endif
 

+ 11 - 1
RedAnt ERP Mobile/iSales-UWAVER/config.h

@@ -10,7 +10,7 @@
 #define RedAnt_ERP_Mobile_config_h
 #define BUILD_UWAVER
 #define BACKORDER_PROCESS // 允许backorder process
-
+#define JSON_TIMEOUT 60
 #define RA_NOTIFICATION
 
 # ifdef DEBUG
@@ -49,6 +49,16 @@
 
 // http://192.168.0.133:8080/site
 // http://12.196.120.217
+
+#define URL_CHANGE_PASSWORD @""
+#define URL_SIGN_UP @""
+#define URL_DELETE_ACCOUNT @""
+#define URL_ORDER_DISCOUNT @""
+#define  URL_SERVER_LIST @""
+#define  URL_SERVER_CHECK @""
+
+
+
 #ifdef test_server
 
 //------------------- chen server-----------------------