diff --git a/DUREX Vendor Control/Base.lproj/DatePickerViewController.xib b/DUREX Vendor Control/Base.lproj/DatePickerViewController.xib
index 3465ebf..3041189 100644
--- a/DUREX Vendor Control/Base.lproj/DatePickerViewController.xib
+++ b/DUREX Vendor Control/Base.lproj/DatePickerViewController.xib
@@ -13,11 +13,11 @@
-
+
-
+
-
+
-
+
diff --git a/DUREX Vendor Control/Base.lproj/Localizable.strings b/DUREX Vendor Control/Base.lproj/Localizable.strings
index 4ff9800..ccc6f2c 100644
--- a/DUREX Vendor Control/Base.lproj/Localizable.strings
+++ b/DUREX Vendor Control/Base.lproj/Localizable.strings
@@ -87,4 +87,9 @@
"Success!" = "Success!";
"Connection to server failed" = "Connection to server failed";
"Error" = "Error";
-"Product" = "Product";
\ No newline at end of file
+"Product" = "Product";
+"Entered price has an invalid format" = "Entered price has an invalid format";
+"Entered product code has an invalid format" = "Entered product code has an invalid format";
+"Entered channel has an invalid format" = "Entered channel has an invalid format";
+"Missing channel" = "Missing channel";
+"Missing product code" = "Missing product code";
\ No newline at end of file
diff --git a/DUREX Vendor Control/Base.lproj/NameChangerViewController.xib b/DUREX Vendor Control/Base.lproj/NameChangerViewController.xib
index 4375c8d..b0f47ba 100644
--- a/DUREX Vendor Control/Base.lproj/NameChangerViewController.xib
+++ b/DUREX Vendor Control/Base.lproj/NameChangerViewController.xib
@@ -19,7 +19,7 @@
-
+
@@ -102,7 +102,7 @@
-
+
diff --git a/DUREX Vendor Control/Base.lproj/PriceChangerViewController.xib b/DUREX Vendor Control/Base.lproj/PriceChangerViewController.xib
index d31f618..9aabf3a 100644
--- a/DUREX Vendor Control/Base.lproj/PriceChangerViewController.xib
+++ b/DUREX Vendor Control/Base.lproj/PriceChangerViewController.xib
@@ -6,7 +6,7 @@
-
+
@@ -15,11 +15,11 @@
-
+
-
+
@@ -102,11 +102,11 @@
-
+
-
+
diff --git a/DUREX Vendor Control/CommunicationProtocol.m b/DUREX Vendor Control/CommunicationProtocol.m
index f7b20f7..2deea0b 100644
--- a/DUREX Vendor Control/CommunicationProtocol.m
+++ b/DUREX Vendor Control/CommunicationProtocol.m
@@ -148,8 +148,11 @@
{
[[EMConnectionManager sharedManager] readResource:@"data" onSuccess:^(id readValue)
{
- [message appendString: readValue];
- [message setString: [message substringToIndex:numBytes]];
+ if([readValue length] < numBytes)
+ {
+ NSLog(@"[CommunicationProtocol.m]: WARNING: Device issued wrong numBytes, possible truncated message.");
+ }
+ [message appendString:[readValue substringToIndex:numBytes]];
NSLog(@"[CommunicationProtocol.m]: data read: %@",message);
}
onFail:^(NSError *error)
diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj
index 0ac0485..91b41cc 100644
--- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj
+++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj
@@ -18,6 +18,8 @@
34AAB88D189805300019860D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 34AAB88C189805300019860D /* Images.xcassets */; };
F9015D9019B73052006C7882 /* DatePickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9015D9219B73052006C7882 /* DatePickerViewController.xib */; };
F9015D9719B7305E006C7882 /* DatePickerViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9015D9919B7305E006C7882 /* DatePickerViewController_iPad.xib */; };
+ F915612919C3D16D00126FE2 /* DateRangePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F915612719C3D16D00126FE2 /* DateRangePickerViewController.m */; };
+ F915612A19C3D16D00126FE2 /* DateRangePickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F915612819C3D16D00126FE2 /* DateRangePickerViewController.xib */; };
F92F567919B75F5E00A1EACA /* PriceChangerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F92F567719B75F5E00A1EACA /* PriceChangerViewController.m */; };
F92F567D19B7609C00A1EACA /* PriceChangerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F92F567F19B7609C00A1EACA /* PriceChangerViewController.xib */; };
F92F568419B760A800A1EACA /* PriceChangerViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F92F568619B760A800A1EACA /* PriceChangerViewController_iPad.xib */; };
@@ -82,6 +84,9 @@
F9015D9819B7305E006C7882 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DatePickerViewController_iPad.xib; sourceTree = ""; };
F9015D9B19B73062006C7882 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/DatePickerViewController_iPad.strings; sourceTree = ""; };
F9015D9D19B73062006C7882 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/DatePickerViewController_iPad.strings; sourceTree = ""; };
+ F915612619C3D16D00126FE2 /* DateRangePickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateRangePickerViewController.h; sourceTree = SOURCE_ROOT; };
+ F915612719C3D16D00126FE2 /* DateRangePickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateRangePickerViewController.m; sourceTree = SOURCE_ROOT; };
+ F915612819C3D16D00126FE2 /* DateRangePickerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DateRangePickerViewController.xib; sourceTree = SOURCE_ROOT; };
F92F567619B75F5E00A1EACA /* PriceChangerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PriceChangerViewController.h; sourceTree = SOURCE_ROOT; };
F92F567719B75F5E00A1EACA /* PriceChangerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PriceChangerViewController.m; sourceTree = SOURCE_ROOT; };
F92F567E19B7609C00A1EACA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PriceChangerViewController.xib; sourceTree = ""; };
@@ -202,6 +207,7 @@
F933F80219B6819400521B90 /* DatePickerViewController.m */,
F92F567719B75F5E00A1EACA /* PriceChangerViewController.m */,
F92F568E19B763FD00A1EACA /* NameChangerViewController.m */,
+ F915612719C3D16D00126FE2 /* DateRangePickerViewController.m */,
34AAB880189804FF0019860D /* main.m */,
F98446EF19B9EAE9005C4992 /* Sensors.m */,
F989B5FE19BCD7A100657DD9 /* Sale.m */,
@@ -291,6 +297,7 @@
F92F568619B760A800A1EACA /* PriceChangerViewController_iPad.xib */,
F92F569419B7665F00A1EACA /* NameChangerViewController.xib */,
F92F569D19B76A5D00A1EACA /* NameChangerViewController_iPad.xib */,
+ F915612819C3D16D00126FE2 /* DateRangePickerViewController.xib */,
);
name = Views;
path = ..;
@@ -307,6 +314,7 @@
F933F80119B6819400521B90 /* DatePickerViewController.h */,
F92F567619B75F5E00A1EACA /* PriceChangerViewController.h */,
F92F568D19B763FD00A1EACA /* NameChangerViewController.h */,
+ F915612619C3D16D00126FE2 /* DateRangePickerViewController.h */,
F98446EE19B9EAE9005C4992 /* Sensors.h */,
F989B5FD19BCD7A100657DD9 /* Sale.h */,
F989B60019BCE28C00657DD9 /* SalesLog.h */,
@@ -393,6 +401,7 @@
F92F569B19B76A5D00A1EACA /* NameChangerViewController_iPad.xib in Resources */,
F92F567D19B7609C00A1EACA /* PriceChangerViewController.xib in Resources */,
F92F569219B7665F00A1EACA /* NameChangerViewController.xib in Resources */,
+ F915612A19C3D16D00126FE2 /* DateRangePickerViewController.xib in Resources */,
F961D80C199A5F2D00E9282C /* back_arrow.png in Resources */,
F961D816199A5FA000E9282C /* Localizable.strings in Resources */,
F97B90CB19B859F500DDA9EF /* icon_checkmark.png in Resources */,
@@ -410,6 +419,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ F915612919C3D16D00126FE2 /* DateRangePickerViewController.m in Sources */,
F92F569019B763FD00A1EACA /* NameChangerViewController.m in Sources */,
F933F80419B6819400521B90 /* DatePickerViewController.m in Sources */,
F989B5FF19BCD7A100657DD9 /* Sale.m in Sources */,
diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
index b18b587..d5ee7d7 100644
--- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 07f5387..e79867b 100644
--- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -26,11 +26,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "724"
- endingLineNumber = "724"
+ startingLineNumber = "717"
+ endingLineNumber = "717"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -42,11 +42,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "666"
- endingLineNumber = "666"
+ startingLineNumber = "659"
+ endingLineNumber = "659"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -58,11 +58,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "522"
- endingLineNumber = "522"
+ startingLineNumber = "511"
+ endingLineNumber = "511"
landmarkName = "-tableView:didSelectRowAtIndexPath:"
landmarkType = "5">
@@ -74,11 +74,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "CommunicationProtocol.m"
- timestampString = "431825157.011553"
+ timestampString = "432263020.427289"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "359"
- endingLineNumber = "359"
+ startingLineNumber = "362"
+ endingLineNumber = "362"
landmarkName = "-readSensorData"
landmarkType = "5">
@@ -90,11 +90,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "CommunicationProtocol.m"
- timestampString = "431825158.083281"
+ timestampString = "432263020.427289"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "358"
- endingLineNumber = "358"
+ startingLineNumber = "361"
+ endingLineNumber = "361"
landmarkName = "-readSensorData"
landmarkType = "5">
@@ -106,11 +106,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "CommunicationProtocol.m"
- timestampString = "431950031.704831"
+ timestampString = "432263020.427289"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "377"
- endingLineNumber = "377"
+ startingLineNumber = "380"
+ endingLineNumber = "380"
landmarkName = "-readSensorData"
landmarkType = "5">
@@ -121,38 +121,6 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "559"
- endingLineNumber = "559"
- landmarkName = "-tableView:didSelectRowAtIndexPath:"
- landmarkType = "5">
-
-
-
-
-
-
-
-
@@ -234,11 +202,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "CommunicationProtocol.m"
- timestampString = "431854565.924087"
+ timestampString = "432263020.427289"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "210"
- endingLineNumber = "210"
+ startingLineNumber = "213"
+ endingLineNumber = "213"
landmarkName = "-writeMessage:"
landmarkType = "5">
@@ -250,11 +218,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431867660.218473"
+ timestampString = "432263020.427289"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "91"
- endingLineNumber = "91"
+ startingLineNumber = "92"
+ endingLineNumber = "92"
landmarkName = "-generateMaintenanceLevel"
landmarkType = "5">
@@ -266,11 +234,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431867660.218473"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "124"
- endingLineNumber = "124"
+ startingLineNumber = "114"
+ endingLineNumber = "114"
landmarkName = "-generateSaleListNavLevel"
landmarkType = "5">
@@ -282,11 +250,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431867660.218473"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "127"
- endingLineNumber = "127"
+ startingLineNumber = "117"
+ endingLineNumber = "117"
landmarkName = "-generateSaleListNavLevel"
landmarkType = "5">
@@ -298,11 +266,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431867660.218473"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "136"
- endingLineNumber = "136"
+ startingLineNumber = "125"
+ endingLineNumber = "125"
landmarkName = "-generateSaleListNavLevel"
landmarkType = "5">
@@ -314,11 +282,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431884750.147748"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "208"
- endingLineNumber = "208"
+ startingLineNumber = "197"
+ endingLineNumber = "197"
landmarkName = "-changeNavLevel::"
landmarkType = "5">
@@ -330,11 +298,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "507"
- endingLineNumber = "507"
+ startingLineNumber = "496"
+ endingLineNumber = "496"
landmarkName = "-tableView:numberOfRowsInSection:"
landmarkType = "5">
@@ -346,11 +314,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "651"
- endingLineNumber = "651"
+ startingLineNumber = "644"
+ endingLineNumber = "644"
landmarkName = "-tableView:indentationLevelForRowAtIndexPath:"
landmarkType = "5">
@@ -362,11 +330,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "671"
- endingLineNumber = "671"
+ startingLineNumber = "664"
+ endingLineNumber = "664"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -378,11 +346,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "864"
- endingLineNumber = "864"
+ startingLineNumber = "857"
+ endingLineNumber = "857"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -394,11 +362,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "865"
- endingLineNumber = "865"
+ startingLineNumber = "858"
+ endingLineNumber = "858"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -426,11 +394,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "984"
- endingLineNumber = "984"
+ startingLineNumber = "977"
+ endingLineNumber = "977"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -442,11 +410,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265052.909736"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "463"
- endingLineNumber = "463"
+ startingLineNumber = "452"
+ endingLineNumber = "452"
landmarkName = "-toggleDropList:"
landmarkType = "5">
@@ -458,11 +426,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1069"
- endingLineNumber = "1069"
+ startingLineNumber = "1062"
+ endingLineNumber = "1062"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -474,11 +442,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431887175.109814"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1061"
- endingLineNumber = "1061"
+ startingLineNumber = "1054"
+ endingLineNumber = "1054"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -490,11 +458,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431950315.399317"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "856"
- endingLineNumber = "856"
+ startingLineNumber = "849"
+ endingLineNumber = "849"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
@@ -506,14 +474,46 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "MenuTableViewController.m"
- timestampString = "431950324.585151"
+ timestampString = "432265160.899922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "854"
- endingLineNumber = "854"
+ startingLineNumber = "847"
+ endingLineNumber = "847"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
+
+
+
+
+
+
+
+
diff --git a/DUREX Vendor Control/DateRangePickerViewController.h b/DUREX Vendor Control/DateRangePickerViewController.h
new file mode 100644
index 0000000..5f059aa
--- /dev/null
+++ b/DUREX Vendor Control/DateRangePickerViewController.h
@@ -0,0 +1,42 @@
+//
+// DateRangePickerViewController.h
+// DUREX Vendor Control
+//
+// Created by Imanol Barba on 9/13/14.
+// Copyright (c) 2014 Emmoco. All rights reserved.
+//
+
+//
+// DatePickerViewController.h
+// DUREX Vendor Control
+//
+// Created by Imanol Barba on 03/09/14.
+// Copyright (c) 2014 Emmoco. All rights reserved.
+//
+
+@class DateRangePickerViewController;
+
+#import
+#import
+#import "DUREXAppDelegate.h"
+
+@protocol DateRangePickerViewControllerDelegate
+- (void)passDateRangeViewController:(DateRangePickerViewController*)controller didFinishEnteringItem:(NSDate*) from : (NSDate*) to;
+
+@end
+
+@interface DateRangePickerViewController : UIViewController
+
+@property (strong, nonatomic) IBOutlet UIView *dateRangePickerView;
+@property (strong, nonatomic) IBOutlet UIDatePicker *fromDate;
+@property (strong, nonatomic) IBOutlet UIDatePicker *toDate;
+@property (strong, nonatomic) IBOutlet UISwitch *fromToggler;
+@property (strong, nonatomic) IBOutlet UISwitch *toToggler;
+@property (nonatomic, strong) id delegate;
+
+- (void)showInView:(UIView *)aView animated:(BOOL)animated;
+- (IBAction)toggleFromDate:(id)sender;
+- (IBAction)toggleToDate:(id)sender;
+- (IBAction)closePopup:(id)sender;
+
+@end
diff --git a/DUREX Vendor Control/DateRangePickerViewController.m b/DUREX Vendor Control/DateRangePickerViewController.m
new file mode 100644
index 0000000..482636b
--- /dev/null
+++ b/DUREX Vendor Control/DateRangePickerViewController.m
@@ -0,0 +1,122 @@
+//
+// DateRangePickerViewController.m
+// DUREX Vendor Control
+//
+// Created by Imanol Barba on 9/13/14.
+// Copyright (c) 2014 Emmoco. All rights reserved.
+//
+
+#import "DateRangePickerViewController.h"
+
+@interface DateRangePickerViewController ()
+
+@end
+
+@implementation DateRangePickerViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ self.view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.7];
+ self.dateRangePickerView.layer.cornerRadius = 5;
+ self.dateRangePickerView.layer.shadowOpacity = 0.8;
+ self.dateRangePickerView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
+
+ //Fix transparency glitch on iPad
+ [self.fromDate setDate:[NSDate dateWithTimeIntervalSince1970:NSTimeIntervalSince1970]];
+ [self.fromDate setDate:[NSDate date]];
+ [self.toDate setDate:[NSDate dateWithTimeIntervalSince1970:NSTimeIntervalSince1970]];
+ [self.toDate setDate:[NSDate date]];
+
+ [super viewDidLoad];
+ // Do any additional setup after loading the view from its nib.
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+- (void)showAnimate
+{
+ self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
+ self.view.alpha = 0;
+ [UIView animateWithDuration:.25 animations:^{
+ self.view.alpha = 1;
+ self.view.transform = CGAffineTransformMakeScale(1, 1);
+ }];
+}
+
+- (void)removeAnimate
+{
+ [UIView animateWithDuration:.25 animations:^{
+ self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
+ self.view.alpha = 0.0;
+ } completion:^(BOOL finished) {
+ if (finished) {
+ [self.view removeFromSuperview];
+ }
+ }];
+}
+
+- (IBAction)toggleFromDate:(id)sender
+{
+ if([[self fromToggler] isOn])
+ {
+ [[self fromDate] setEnabled:TRUE];
+ [[self fromDate] setHidden:FALSE];
+ }
+ else
+ {
+ [[self fromDate] setEnabled:FALSE];
+ [[self fromDate] setHidden:TRUE];
+ }
+}
+- (IBAction)toggleToDate:(id)sender
+{
+ if([[self toToggler] isOn])
+ {
+ [[self toDate] setEnabled:TRUE];
+ [[self toDate] setHidden:FALSE];
+ }
+ else
+ {
+ [[self toDate] setEnabled:FALSE];
+ [[self toDate] setHidden:TRUE];
+ }
+}
+
+- (IBAction)closePopup:(id)sender
+{
+ NSDate *from = nil;
+ NSDate *to = nil;
+ if([[self fromToggler] isOn])
+ {
+ from = [[self fromDate] date];
+ }
+ if([[self toToggler] isOn])
+ {
+ to = [[self toDate] date];
+ }
+ [self.delegate passDateRangeViewController:self didFinishEnteringItem:from : to];
+ [self removeAnimate];
+}
+
+- (void)showInView:(UIView *)aView animated:(BOOL)animated
+{
+ [aView addSubview:self.view];
+ if (animated) {
+ [self showAnimate];
+ }
+}
+
+@end
\ No newline at end of file
diff --git a/DUREX Vendor Control/DateRangePickerViewController.xib b/DUREX Vendor Control/DateRangePickerViewController.xib
new file mode 100644
index 0000000..2308000
--- /dev/null
+++ b/DUREX Vendor Control/DateRangePickerViewController.xib
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
+y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
+5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
+8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
+AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
+DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
+HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
+KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
+OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
+Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
+VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
+Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
+cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
+f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
+AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
+AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
+AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
+y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
+5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
+8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
+AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
+DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
+HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
+KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
+OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
+Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
+VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
+Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
+cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
+f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
+AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
+AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
+AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m b/DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
index 54b7333..c0b1605 100644
--- a/DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
+++ b/DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
@@ -34,6 +34,7 @@
- (void)viewDidLoad
{
[super viewDidLoad];
+ [[EMConnectionManager sharedManager] setBackgroundUpdatesEnabled:TRUE];
[[EMConnectionListManager sharedManager] addObserver:self forKeyPath:@"devices" options:0 context:NULL];
}
@@ -105,7 +106,7 @@
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
- //[self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
+ [self performSegueWithIdentifier:@"ConnectionSegue" sender:self];
if(![[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text] isEqualToString:NSLocalizedString(@"Searching for devices...",nil)])
{
[self _showConnectingView];
diff --git a/DUREX Vendor Control/MenuTableViewController.h b/DUREX Vendor Control/MenuTableViewController.h
index 585b8f9..2aa92f9 100644
--- a/DUREX Vendor Control/MenuTableViewController.h
+++ b/DUREX Vendor Control/MenuTableViewController.h
@@ -13,6 +13,7 @@
#import "DatePickerViewController.h"
#import "PriceChangerViewController.h"
#import "NameChangerViewController.h"
+#import "DateRangePickerViewController.h"
#import "Sensors.h"
#import "SalesLog.h"
#import "UIView+Toast.h"
@@ -55,12 +56,18 @@ enum {
REPORT,
} navigationLevel;
-@interface MenuTableViewController : UITableViewController
+enum {
+ SALES_LOG = 0,
+ INCIDENT_LOG,
+} logType;
+
+@interface MenuTableViewController : UITableViewController
@property (strong,nonatomic) Stack *parentLayout;
@property (strong,nonatomic) DatePickerViewController *datePickerViewController;
@property (strong,nonatomic) PriceChangerViewController *priceChangerViewController;
@property (strong,nonatomic) NameChangerViewController *nameChangerViewController;
+@property (strong,nonatomic) DateRangePickerViewController *dateRangePickerViewController;
@property (strong,nonatomic) Sensors *sensorStatus;
@property (strong,nonatomic) SalesLog *salesLog;
@property (strong,nonatomic) Sale *currentSale;
diff --git a/DUREX Vendor Control/MenuTableViewController.m b/DUREX Vendor Control/MenuTableViewController.m
index f35a2f6..33aa3f6 100644
--- a/DUREX Vendor Control/MenuTableViewController.m
+++ b/DUREX Vendor Control/MenuTableViewController.m
@@ -42,6 +42,7 @@
@property const NSMutableArray *currentStructure;
@property const NSMutableArray *currentHeaders;
+@property uint8_t requestedLog;
@end
@implementation MenuTableViewController
@@ -108,19 +109,8 @@
return TRUE;
}
-- (Boolean) generateSaleListNavLevel
+- (void) generateSaleListNavLevel
{
- //Initialize sales log
- [self setSalesLog:[[SalesLog alloc]init]];
-
- //LAUNCH DATE RANGE SELECTOR
- NSString *salesData = [_protocol readSalesLog: nil : nil];
- if(salesData == nil)
- {
- NSLog(@"[MenuTableViewController.m]: Error reading sales log");
- return FALSE;
- }
- [[self salesLog] setResponseValue:salesData];
NSMutableArray *dateArray = [[NSMutableArray alloc] init];
for(int i = 0; i < [[[self salesLog] sales]count]; i++)
{
@@ -133,7 +123,6 @@
[self setSaleListElements:[[NSMutableArray alloc] initWithArray:dateArray]];
[self setSaleListStructure:[[NSMutableArray alloc] initWithObjects:[NSNumber numberWithInt:[dateArray count]], nil]];
[self setSaleListHeaders:nil];
- return TRUE;
}
- (Boolean) generateSaleNavLevel : (NSInteger) numSale
@@ -312,7 +301,7 @@
//DUREX protocol
if(![_protocol establishConnection])
{
- UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Communication error" message:@"Error while trying to connect to the device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Communication error",nil) message:NSLocalizedString(@"Error while trying to connect to the device",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
[alert show];
UIViewController *previous = [[[self navigationController] viewControllers] objectAtIndex:[[[self navigationController] viewControllers] count]-2];
[[self navigationController] popToViewController:previous animated:YES];
@@ -521,7 +510,7 @@
NSLog(@"[MenuTableViewController.m]: Changing to navLevel: MAINTENANCE");
if([self generateMaintenanceLevel])
{
- [NSThread sleepForTimeInterval:1];
+ [NSThread sleepForTimeInterval:1]; //HACK!
[self changeNavLevel:MAINTENANCE:TRUE];
}
else
@@ -554,16 +543,20 @@
}
else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)])
{
- [NSThread sleepForTimeInterval:1];
- NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALE_LIST");
- if([self generateSaleListNavLevel])
+ [self setRequestedLog:SALES_LOG];
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
- [self changeNavLevel:SALE_LIST:TRUE];
+ self.dateRangePickerViewController = [[DateRangePickerViewController alloc] initWithNibName:@"DateRangePickerViewController_iPad" bundle:nil];
+ self.dateRangePickerViewController.delegate = self;
+ [self.dateRangePickerViewController showInView:self.navigationController.view animated:YES];
}
else
{
- NSLog(@"[MenuTableViewController.m]: Error while changing to navLevel: SALE_LIST");
+ self.dateRangePickerViewController = [[DateRangePickerViewController alloc] initWithNibName:@"DateRangePickerViewController" bundle:nil];
+ self.dateRangePickerViewController.delegate = self;
+ [self.dateRangePickerViewController showInView:self.navigationController.view animated:YES];
}
+
}
else if([cellName isEqualToString:NSLocalizedString(@"Send report", nil)])
{
@@ -712,7 +705,7 @@
}
//PARSE AND REMOVE TAG
NSInteger lastPos = [cellText rangeOfString:@"]"].location;
- NSInteger cellTag = [[cellText substringWithRange:NSMakeRange(1,lastPos)] intValue];
+ NSInteger cellTag = [[cellText substringWithRange:NSMakeRange(1,lastPos-1)] intValue];
[cell setTag:cellTag];
[cellText setString:[cellText substringFromIndex:lastPos+1]];
//SET FINAL TEXT
@@ -1086,20 +1079,108 @@
{
NSLog(@"[MenuTableViewController.m]: %@", data);
//Channel,Code,Price
- int channel = [[data objectAtIndex:0] intValue];
- int code = [[data objectAtIndex:1] intValue];
- NSArray *price = [[data objectAtIndex:2] componentsSeparatedByString:@","];
- [_protocol updatePrice:channel :code :[[price objectAtIndex:0] intValue] :[[price objectAtIndex:1] intValue]];
+ NSString *channelString = [data objectAtIndex:0];
+ NSString *codeString = [data objectAtIndex:1];
+ NSString *priceString = [data objectAtIndex:2];
+ if(![[NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"^\\d+(\\.\\d+)?$"] options:0 error:NULL] numberOfMatchesInString:priceString options:0 range:NSMakeRange(0,[priceString length])])
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Entered price has an invalid format",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if([channelString length] == 0)
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Missing channel",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if([codeString length] == 0)
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Missing product code",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if(![[NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"\\d+"] options:0 error:NULL] numberOfMatchesInString:channelString options:0 range:NSMakeRange(0,[channelString length])])
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Entered channel has an invalid format",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if(![[NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"\\d+"] options:0 error:NULL] numberOfMatchesInString:codeString options:0 range:NSMakeRange(0,[codeString length])])
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Entered product code has an invalid format",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else
+ {
+ int channel = [channelString intValue];
+ int code = [codeString intValue];
+ NSArray *price = [priceString componentsSeparatedByString:@"."];
+ [_protocol updatePrice:channel :code :[[price objectAtIndex:0] intValue] :[[price objectAtIndex:1] intValue]];
+ }
}
- (void)passNameViewController:(PriceChangerViewController *)controller didFinishEnteringItem:(NSArray *)data
{
NSLog(@"[MenuTableViewController.m]: %@", data);
//Channel,Code,Name
- int channel = [[data objectAtIndex:0] intValue];
- int code = [[data objectAtIndex:1] intValue];
+ NSString *channelString = [data objectAtIndex:0];
+ NSString *codeString = [data objectAtIndex:1];
NSString *name = [data objectAtIndex:2];
- [_protocol updateProductName:channel :code :name];
+ if([channelString length] == 0)
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Missing channel",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if([codeString length] == 0)
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Missing product code",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if(![[NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"\\d+"] options:0 error:NULL] numberOfMatchesInString:channelString options:0 range:NSMakeRange(0,[channelString length])])
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Entered channel has an invalid format",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else if(![[NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"\\d+"] options:0 error:NULL] numberOfMatchesInString:codeString options:0 range:NSMakeRange(0,[codeString length])])
+ {
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error",nil) message:NSLocalizedString(@"Entered product code has an invalid format",nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",nil) otherButtonTitles:nil];
+ [alert show];
+ }
+ else
+ {
+ int channel = [channelString intValue];
+ int code = [codeString intValue];
+ [_protocol updateProductName:channel :code :name];
+ }
+}
+
+- (void) passDateRangeViewController:(DateRangePickerViewController*)controller didFinishEnteringItem:(NSDate*) from : (NSDate*) to
+{
+ [NSThread sleepForTimeInterval:1]; //HACK!
+ if([self requestedLog] == SALES_LOG)
+ {
+ NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALE_LIST");
+
+ //Initialize sales log
+ [self setSalesLog:[[SalesLog alloc]init]];
+
+ NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
+ NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
+ NSDateComponents *componentsFrom = [calendar components:units fromDate:from];
+ NSDateComponents *componentsTo = [calendar components:units fromDate:to];
+ NSString *salesData = [_protocol readSalesLog: componentsFrom : componentsTo];
+ if(salesData == nil)
+ {
+ NSLog(@"[MenuTableViewController.m]: Error reading sales log");
+ }
+ else
+ {
+ [[self salesLog] setResponseValue:salesData];
+ [self generateSaleListNavLevel];
+ [self changeNavLevel:SALE_LIST:TRUE];
+ }
+ }
+ else if([self requestedLog] == INCIDENT_LOG)
+ {
+
+ }
}
@end
diff --git a/DUREX Vendor Control/PriceChangerViewController.m b/DUREX Vendor Control/PriceChangerViewController.m
index 9282561..9a974e3 100644
--- a/DUREX Vendor Control/PriceChangerViewController.m
+++ b/DUREX Vendor Control/PriceChangerViewController.m
@@ -84,8 +84,25 @@
}];
}
+- (void) formatPrice
+{
+ NSMutableString *priceText = [NSMutableString stringWithString:[[self price] text]];
+ [priceText replaceOccurrencesOfString:@"," withString:@"." options:NSLiteralSearch range:NSMakeRange(0, [priceText length])];
+ NSUInteger commaPos = [priceText rangeOfString:@"."].location;
+ if(commaPos == NSNotFound)
+ {
+ [priceText appendString:@".00"];
+ }
+ else if(commaPos == [priceText length] - 2)
+ {
+ [priceText appendString:@"0"];
+ }
+ [[self price] setText:priceText];
+}
+
- (IBAction)closePopup:(id)sender
{
+ [self formatPrice];
NSArray *data = [[NSArray alloc] initWithObjects:[[self channel] text],[[self code] text],[[self price] text], nil];
[self.delegate passPriceViewController:self didFinishEnteringItem:data];
[self removeAnimate];
diff --git a/DUREX Vendor Control/en.lproj/Localizable.strings b/DUREX Vendor Control/en.lproj/Localizable.strings
index 077a4b4..8fd9144 100644
--- a/DUREX Vendor Control/en.lproj/Localizable.strings
+++ b/DUREX Vendor Control/en.lproj/Localizable.strings
@@ -87,4 +87,9 @@
"Success!" = "Success!";
"Connection to server failed" = "Connection to server failed";
"Error" = "Error";
-"Product" = "Product";
\ No newline at end of file
+"Product" = "Product";
+"Entered price has an invalid format" = "Entered price has an invalid format";
+"Entered product code has an invalid format" = "Entered product code has an invalid format";
+"Entered channel has an invalid format" = "Entered channel has an invalid format";
+"Missing channel" = "Missing channel";
+"Missing product code" = "Missing product code";
\ No newline at end of file
diff --git a/DUREX Vendor Control/es.lproj/Localizable.strings b/DUREX Vendor Control/es.lproj/Localizable.strings
index 3d53d07..0ccd65e 100644
--- a/DUREX Vendor Control/es.lproj/Localizable.strings
+++ b/DUREX Vendor Control/es.lproj/Localizable.strings
@@ -87,4 +87,9 @@
"Success!" = "Éxito!";
"Connection to server failed" = "Conexión al servidor fallida";
"Error" = "Error";
-"Product" = "Producto";
\ No newline at end of file
+"Product" = "Producto";
+"Entered price has an invalid format" = "El precio introducido está en un formato incorrecto";
+"Entered code has an invalid format" = "El código de producto introducido está en un formato incorrecto";
+"Entered channel has an invalid format" = "El canal introducido está en un formato incorrecto";
+"Missing channel" = "Falta el canal";
+"Missing product code" = "Falta el código del producto";
\ No newline at end of file
diff --git a/TODO b/TODO
index 7456e86..65d291f 100644
--- a/TODO
+++ b/TODO
@@ -1,18 +1,17 @@
BUGS:
- On date change, response is overwritten by previous query, trimming needed according to numBytes
-- Sanitize input on name/price change
-- Handle disconnects properly
-- Month headers on sale list
-- Add robustness in case of invalid length
-- Add landscape layout and inverted layout
TODO:
- Reimplement protocol with async pattern
+(WIP) - Add date range on Log request
+- Handle disconnects properly
- Incident class
- Incident parser
- A3 command
- Channels and codes to 2 ciphers
+- Add landscape layout and inverted layout
+- Month/Year headers on sale list
- Batch command files, definition, parsing and pushing them to the app
- Implement user auth. Server authenticates the app ONCE on install and allows to control ONE machine (key gets validated on server and then stored on app)