Kaynağa Gözat

HMLG Scan Order 1.34

Fix notification issue
Remove stock display when user logout

Contrast Mobile
Modify offline module, add order discount
Ray Zhang 3 yıl önce
ebeveyn
işleme
fb4fb1a6de

+ 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>3</integer>
+			<integer>1</integer>
 		</dict>
 	</dict>
 </dict>

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

@@ -26,6 +26,8 @@
 @property (strong,nonatomic) NSDictionary* freejson;
 @property (weak, nonatomic) IBOutlet UIButton *btnBulkDiscount;
 
+
+
 @property (weak, nonatomic) IBOutlet UIButton *btnPrice;
 @property (strong,nonatomic) NSString* orderid;
 @property (strong, nonatomic) IBOutlet UIButton *btnselect;

+ 6 - 3
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -1579,7 +1579,8 @@
 //                                    [appDelegate SetSo:nil];
 //                                    [appDelegate set_main_button_panel];
                         #ifdef RA_NOTIFICATION
-                                    [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
+                                    [ActiveViewController Notify:@"ScanSearchViewController" Message:RA_NOTIFICATION_REFRESH_UI];
+                                    [ActiveViewController Notify:@"ScanHistoryViewController" Message:RA_NOTIFICATION_REFRESH_UI];
                         #endif
 //                                    [appDelegate Logout];
                                 }];
@@ -1618,7 +1619,8 @@
 //                                    [appDelegate SetSo:nil];
 //                                    [appDelegate set_main_button_panel];
                         #ifdef RA_NOTIFICATION
-                                    [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
+                                    [ActiveViewController Notify:@"ScanSearchViewController" Message:RA_NOTIFICATION_REFRESH_UI];
+                                    [ActiveViewController Notify:@"ScanHIstoryViewController" Message:RA_NOTIFICATION_REFRESH_UI];
                         #endif
 //                                    [appDelegate Logout];
                
@@ -1669,7 +1671,8 @@
                             
 //                            [appDelegate set_main_button_panel];
                 #ifdef RA_NOTIFICATION
-                            [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
+                            [ActiveViewController Notify:@"ScanSearchViewController" Message:RA_NOTIFICATION_REFRESH_UI];
+                            [ActiveViewController Notify:@"ScanHistoryViewController" Message:RA_NOTIFICATION_REFRESH_UI];
                 #endif
 //                            [appDelegate Logout];
                         }];

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

@@ -7,6 +7,7 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "config.h"
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 1 - 0
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

+ 13 - 0
RedAnt ERP Mobile/HMLG Scan Order/ScanSearchViewController.m

@@ -515,4 +515,17 @@
     [self reload];
     
 }
+-(void) refresh_ui
+{
+    [self.tableview reloadData];
+}
+
+//-(void) clear_data
+//{
+//    [self.modellist removeAllObjects];
+//    self.offset = 0;
+//    self.keywords = nil;
+//    self.searchBar.text = nil;
+//    [self.tableview reloadData];
+//}
 @end

+ 4 - 0
RedAnt ERP Mobile/common/ActiveViewController.m

@@ -398,6 +398,10 @@
 }
 - (void)OnClearData: (NSNotification *)notification
 {
+    NSDictionary* dict = [notification userInfo];
+    NSArray* arr= dict[@"receiver"];
+    if([arr indexOfObject:[self class_name]]==NSNotFound&& arr.count>0)
+        return;
 
         if(![self respondsToSelector:@selector(clear_data)])
         return;

+ 2 - 1
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -36,7 +36,7 @@
 #import "RAOrderEditorViewController.h"
 #endif
 #import "RAConvertor.h"
-#import "config.h"
+//#import "config.h"
 #define UNZIP_OPEN_FAILED 0
 #define UNZIP_SUCCESS 1
 #define UNZIP_NO_SPACE 2
@@ -1193,6 +1193,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         
 #ifdef RA_NOTIFICATION
         [ActiveViewController Notify:@"SearchViewController" Message:RA_NOTIFICATION_CLEAR_DATA];
+
 #endif
         
         [main_vc hideMenu];

+ 20 - 11
RedAnt ERP Mobile/common/ERP_Mobile_Cart.storyboard

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="ipad7_9" orientation="portrait" layout="fullscreen" appearance="light"/>
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -29,7 +29,7 @@
                                         <color key="sectionIndexBackgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <prototypes>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="ContrastCartItemCell" rowHeight="146" id="9d9-Fh-IGR" customClass="ContrastModelItemCell">
-                                                <rect key="frame" x="0.0" y="44.5" width="744" height="146"/>
+                                                <rect key="frame" x="0.0" y="50" width="744" height="146"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9d9-Fh-IGR" id="NLP-mv-Q7E">
                                                     <rect key="frame" x="0.0" y="0.0" width="744" height="146"/>
@@ -223,7 +223,7 @@ Stock</string>
                                                 </connections>
                                             </tableViewCell>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="CartItemCell" rowHeight="146" id="IPG-eZ-Ldx" customClass="ModelItemCell">
-                                                <rect key="frame" x="0.0" y="190.5" width="744" height="146"/>
+                                                <rect key="frame" x="0.0" y="196" width="744" height="146"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="IPG-eZ-Ldx" id="aV7-ct-m80">
                                                     <rect key="frame" x="0.0" y="0.0" width="744" height="146"/>
@@ -440,7 +440,7 @@ Stock</string>
                                                 </connections>
                                             </tableViewCell>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="ScanCartItemCell" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="ScanCartItemCell" rowHeight="120" id="fca-Fb-rTa" customClass="ScanCartItemCell">
-                                                <rect key="frame" x="0.0" y="336.5" width="744" height="120"/>
+                                                <rect key="frame" x="0.0" y="342" width="744" height="120"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fca-Fb-rTa" id="efk-9P-2wE">
                                                     <rect key="frame" x="0.0" y="0.0" width="744" height="120"/>
@@ -520,7 +520,7 @@ Stock</string>
                                                             <nil key="highlightedColor"/>
                                                         </label>
                                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kns-xs-xWh">
-                                                            <rect key="frame" x="425" y="78" width="169" height="31"/>
+                                                            <rect key="frame" x="425" y="74.5" width="169" height="34.5"/>
                                                             <state key="normal" title="Button"/>
                                                             <buttonConfiguration key="configuration" style="plain" title="Discount"/>
                                                             <connections>
@@ -565,7 +565,7 @@ Stock</string>
                                                 </connections>
                                             </tableViewCell>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="section_header_cell" rowHeight="50" id="XyA-7C-sJn">
-                                                <rect key="frame" x="0.0" y="456.5" width="744" height="50"/>
+                                                <rect key="frame" x="0.0" y="462" width="744" height="50"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="XyA-7C-sJn" translatesAutoresizingMaskIntoConstraints="NO" id="Ugp-AX-JtS">
                                                     <rect key="frame" x="0.0" y="0.0" width="744" height="50"/>
@@ -874,24 +874,32 @@ Stock</string>
                                         </connections>
                                     </button>
                                     <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Q8b-hd-FFZ">
-                                        <rect key="frame" x="123.5" y="9.5" width="81.5" height="31"/>
+                                        <rect key="frame" x="65" y="8" width="92" height="34.5"/>
                                         <state key="normal" title="Button"/>
                                         <buttonConfiguration key="configuration" style="plain" title="Discount"/>
                                         <connections>
                                             <action selector="onOrderDiscount:" destination="K4s-dn-ekA" eventType="touchUpInside" id="k2O-iA-gh7"/>
                                         </connections>
                                     </button>
+                                    <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="90%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LmV-f2-f9F">
+                                        <rect key="frame" x="167" y="14.5" width="36" height="21"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
                                 </subviews>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstItem="Yo2-dv-uQb" firstAttribute="firstBaseline" secondItem="PWY-Zc-LEx" secondAttribute="firstBaseline" id="3oV-SY-C7K"/>
                                     <constraint firstItem="e8a-7k-glR" firstAttribute="leading" secondItem="oeZ-Yi-d5I" secondAttribute="trailing" constant="30" id="46d-4o-t6S"/>
                                     <constraint firstItem="PaU-lk-9JI" firstAttribute="leading" secondItem="gh3-Tt-1Iu" secondAttribute="leading" constant="15" id="4NC-OC-K1K"/>
+                                    <constraint firstItem="LmV-f2-f9F" firstAttribute="leading" secondItem="Q8b-hd-FFZ" secondAttribute="trailing" constant="10" id="5Ze-q7-tAg"/>
                                     <constraint firstAttribute="bottom" secondItem="Rdv-8s-Jy6" secondAttribute="bottom" constant="10" id="9HN-hM-LS5"/>
                                     <constraint firstItem="QFj-Yq-8py" firstAttribute="firstBaseline" secondItem="jqa-Zp-Sg2" secondAttribute="firstBaseline" id="EGe-y6-4q4"/>
                                     <constraint firstItem="WY7-cp-N9a" firstAttribute="bottom" secondItem="Y27-jk-l1Z" secondAttribute="bottom" id="FVK-Cq-cwW"/>
                                     <constraint firstItem="WY7-cp-N9a" firstAttribute="leading" secondItem="y50-hu-fgy" secondAttribute="trailing" constant="20" id="H5T-sh-uLl"/>
                                     <constraint firstItem="4kM-vh-YbC" firstAttribute="firstBaseline" secondItem="PWY-Zc-LEx" secondAttribute="firstBaseline" id="KOa-XX-vVe"/>
+                                    <constraint firstItem="Q8b-hd-FFZ" firstAttribute="leading" secondItem="PaU-lk-9JI" secondAttribute="trailing" constant="20" id="MNg-QU-tFI"/>
                                     <constraint firstItem="9Da-eJ-p37" firstAttribute="leading" secondItem="4kM-vh-YbC" secondAttribute="trailing" constant="8" id="OuM-vA-BAv"/>
                                     <constraint firstItem="BdK-WN-iBd" firstAttribute="leading" secondItem="e8a-7k-glR" secondAttribute="trailing" constant="8" id="SVT-rP-g0R"/>
                                     <constraint firstItem="bJB-df-Qia" firstAttribute="leading" secondItem="QFj-Yq-8py" secondAttribute="trailing" constant="30" id="TRd-wt-Vi6"/>
@@ -904,9 +912,9 @@ Stock</string>
                                     <constraint firstItem="Yo2-dv-uQb" firstAttribute="leading" secondItem="PWY-Zc-LEx" secondAttribute="trailing" constant="8" id="drF-ry-GzB"/>
                                     <constraint firstItem="QFj-Yq-8py" firstAttribute="leading" secondItem="jqa-Zp-Sg2" secondAttribute="trailing" constant="8" id="dsd-2F-VIn"/>
                                     <constraint firstItem="y50-hu-fgy" firstAttribute="bottom" secondItem="Y27-jk-l1Z" secondAttribute="bottom" id="ejp-Ep-tEn"/>
+                                    <constraint firstItem="LmV-f2-f9F" firstAttribute="centerY" secondItem="Q8b-hd-FFZ" secondAttribute="centerY" id="erN-yi-O1F"/>
                                     <constraint firstItem="YOv-h4-k5B" firstAttribute="top" secondItem="jbg-4H-dCx" secondAttribute="bottom" constant="7" id="fUg-rL-ofh"/>
                                     <constraint firstItem="PaU-lk-9JI" firstAttribute="top" secondItem="gh3-Tt-1Iu" secondAttribute="top" constant="10" id="g7g-XM-FCI"/>
-                                    <constraint firstItem="jqa-Zp-Sg2" firstAttribute="leading" secondItem="Q8b-hd-FFZ" secondAttribute="trailing" constant="10" id="iTM-uD-RLZ"/>
                                     <constraint firstItem="zeq-Qm-obt" firstAttribute="firstBaseline" secondItem="bJB-df-Qia" secondAttribute="firstBaseline" id="jOl-qT-Bqm"/>
                                     <constraint firstItem="YOv-h4-k5B" firstAttribute="leading" secondItem="gh3-Tt-1Iu" secondAttribute="leading" constant="15" id="je1-DO-KU5"/>
                                     <constraint firstItem="jbg-4H-dCx" firstAttribute="top" secondItem="PaU-lk-9JI" secondAttribute="bottom" constant="7" id="ji0-ci-UXf"/>
@@ -958,6 +966,7 @@ Stock</string>
                         <outlet property="editButton" destination="PaU-lk-9JI" id="FQT-bW-eks"/>
                         <outlet property="emailButton" destination="y50-hu-fgy" id="Pgg-5v-pxL"/>
                         <outlet property="itemListTable" destination="OMD-NW-nZo" id="LM4-Uh-sbX"/>
+                        <outlet property="labelDiscount" destination="LmV-f2-f9F" id="OQr-Lj-FhQ"/>
                         <outlet property="labelTotal" destination="BdK-WN-iBd" id="Un4-Px-xlm"/>
                         <outlet property="labelTotalCarton" destination="1bF-Cv-KYG" id="rxW-1B-6Us"/>
                         <outlet property="labelTotalWeight" destination="PWY-Zc-LEx" id="j6U-Vk-jwC"/>
@@ -1274,7 +1283,7 @@ Stock</string>
                                 <nil key="highlightedColor"/>
                             </label>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Mp7-AD-fSK">
-                                <rect key="frame" x="321.5" y="239" width="68.5" height="31"/>
+                                <rect key="frame" x="313.5" y="235.5" width="76.5" height="34.5"/>
                                 <state key="normal" title="Button"/>
                                 <buttonConfiguration key="configuration" style="plain" title="Cancel"/>
                                 <connections>
@@ -1282,7 +1291,7 @@ Stock</string>
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6tg-ic-Sng">
-                                <rect key="frame" x="90" y="239" width="71.5" height="31"/>
+                                <rect key="frame" x="90" y="235.5" width="80" height="34.5"/>
                                 <state key="normal" title="Button"/>
                                 <buttonConfiguration key="configuration" style="plain" title="Update"/>
                                 <connections>

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

@@ -39,7 +39,11 @@
 @property int total_item;
 @property int total_QTY;
 @property bool edit_check;
+
+@property double orderdiscount;
+
 @property (weak, nonatomic) IBOutlet UIButton *btnOrderDiscount;
+@property (weak, nonatomic) IBOutlet UILabel *labelDiscount;
 @property (weak, nonatomic) IBOutlet UILabel *labelTotalPrice;
 @property (weak, nonatomic) IBOutlet UILabel *labelTotalSurcharge;
 
@@ -52,6 +56,7 @@
 @property (strong, nonatomic) IBOutlet UIActivityIndicatorView *mum;
 -(void)placeOrder;
 
+
 @property (nonatomic , copy) void (^onFinishLoad)(void);
 //@property (strong, nonatomic) IBOutlet UITableView *orderInfoTableView;
 //@property (strong, nonatomic) IBOutlet UITextField *editCount;

+ 23 - 45
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -898,6 +898,13 @@
                             weakself.back_order_flag = NO;
             #endif
                             
+                            
+#ifdef BUILD_CONTRAST
+
+                            weakself.orderdiscount = [cart_json[@"discount"] doubleValue];
+#endif
+      
+                            
                             if (!weakself.back_order_flag) {
                                 weakself.freejson = [cart_json objectForKey:@"freeGiveaway"];
                                 weakself.notes = [cart_json valueForKey:@"general_note"];
@@ -1433,6 +1440,7 @@
     
 #ifdef BUILD_CONTRAST
     self.btnOrderDiscount.hidden=false;
+    self.labelDiscount.hidden = false;
 #endif
     
 #ifdef SCANNER_ORDER
@@ -1516,6 +1524,7 @@
     [self.view addSubview:self.cartIndicatorBar];
     
 }
+#ifdef SCANNER_ORDER
 -(void) cartrefresh: (NSNotification *)notification
 {
     [OLDataProvider scanRefreshCart];
@@ -1523,6 +1532,7 @@
 //    [self refresh_total];
 //    [self refresh_ui];
 }
+#endif
 //-(void)SelectOrder:(NSString *)orderid
 //{
 ////    self.editOrderID.text=orderid;
@@ -3206,6 +3216,15 @@
     self.total_item=0;
     self.surcharge=0;
     
+#ifdef BUILD_CONTRAST
+
+//    if(self.orderdiscount==0)
+//        self.labelDiscount.text = @"N/A";
+//    else
+        self.labelDiscount.text = [NSString stringWithFormat:@"%.2f%% off",self.orderdiscount*100];
+#endif
+    
+    
 #ifdef SCANNER_ORDER
     
     NSString* pricename;
@@ -3264,51 +3283,7 @@
             
             int item_qty=1;
 //            NSDictionary * bundle_item =[item_json objectForKey:@"combine"];
-#ifdef SCANNER_ORDER
-            double msurcharge =0;
-            if(RASingleton.sharedInstance.price_type==1)
-            {
-                if([item_json[@"special_price"] boolValue])
-                {
-                    msurcharge=([item_json[price_group[@"price_3"][@"name"]] doubleValue]-[item_json[price_group[@"price_2"][@"name"]] doubleValue])*count*(1-discount/100.0);
-                    if(msurcharge<0)
-                        msurcharge = 0;
-                }
-                else
-                {
-                    msurcharge=([item_json[price_group[@"price_3"][@"name"]] doubleValue]-[item_json[price_group[@"price_1"][@"name"]] doubleValue])*count*(1-discount/100.0);
-                    if(msurcharge<0)
-                        msurcharge = 0;
 
-                    
-                }
-            }
-
-            
-//            double dprice=0;
-            
-//            if(bundle_item!=nil)
-//            {
-//                //  int citem=0;
-//
-//                int bcount=[[bundle_item valueForKey:@"count"] intValue];
-//                for(int bc=0;bc<bcount;bc++)
-//                {
-//                    NSDictionary * bitem = [bundle_item objectForKey:[NSString stringWithFormat:@"item_%d",bc]];
-//                    int modulus= [[bitem valueForKey:@"modulus"] intValue];
-//                    //    citem+= modulus;
-//                    item_count+=1;
-//                    item_qty+=modulus;
-//                    double uprice= [[bitem valueForKey:@"unit_price"]doubleValue];
-//                    dprice+= uprice*modulus*count;
-//
-//                }
-//            }
-//            totalprice+= dprice;
-            
-            
-            self.surcharge+=msurcharge;
-#endif
             self.total+=totalprice;
             self.total_cuft+=cuft;
             self.total_carton+=carton;
@@ -3322,7 +3297,10 @@
         
     }
     
-    
+#ifdef BUILD_CONTRAST
+
+    self.total= self.total* (1-self.orderdiscount);
+#endif
     NSString* subtotal = [RAConvertor currencyNumber:self.total];//[NSString stringWithFormat:@"$%@",];
     NSString* subcuft = [NSString stringWithFormat:@"%.2f",self.total_cuft];
     NSString* subcarton = [NSString stringWithFormat:@"%d",self.total_carton];

+ 8 - 2
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.h

@@ -150,10 +150,12 @@ typedef void(^resultHandler)(NSMutableDictionary *result);
 //+(void) offline_add2cartbyname :(NSMutableDictionary *) params completionHandler:(resultHandler)result;
 //+(void) offline_movewish2cart:(NSMutableDictionary *)params completionHandler:(resultHandler)result;
 //+(void) addAll:(NSMutableDictionary *) params from:(int)from completionHandler:(resultHandler)result;
-+(NSData*) offline_cartsetallprice :(NSMutableDictionary *) params;
+//+(NSData*) offline_cartsetallprice :(NSMutableDictionary *) params;
+
++(NSDictionary*) offline_setorderdiscount :(NSMutableDictionary *) params;
 
 //scan order
-+(void) saveScanCart:(NSMutableDictionary*) cart;
+
 //+(void) save2submitScanOrder;
 +(void) save2submitScanOrder:(NSString*) soid company:(NSString*) company;
 +(void) deleteScanOrder:(NSString*) order_code;
@@ -177,5 +179,9 @@ typedef void(^resultHandler)(NSMutableDictionary *result);
 +(bool) isSavedScanOrder:(NSString*) order_code;
 +(void) saveScanOrderList:(NSMutableDictionary*) orderlist;
 +(NSMutableDictionary*) getScanSubmitList;
+
+#ifdef SCANNER_ORDER
 +(void) scanRefreshCart;
++(void) saveScanCart:(NSMutableDictionary*) cart;
+#endif
 @end

+ 50 - 3
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -10305,10 +10305,57 @@ if(stockUom==0)
     return [RAConvertor dict2data:dic];
 }
 
-#pragma mark set price
-+(NSDictionary*) offline_cartsetallprice :(NSMutableDictionary *) params
+#pragma mark set order discount
+//+(NSDictionary*) offline_cartsetallprice :(NSMutableDictionary *) params
+//{
+//    DebugLog(@"cart set price params: %@",params);
+//    //    "cartitem_id" = 1;
+//    //    discount = "0.000000";
+//    //    "item_note" = "";
+//    //     price = "269.000000";
+//    NSString *order_code = [self valueInParams:params key:@"orderCode"];
+//    //NSString *notes = [self valueInParams:params key:@"item_note"];
+//    NSString *discount = [self valueInParams:params key:@"app_discount"];
+////    NSString *price = [self valueInParams:params key:@"price"];
+//
+//    //    bool badd_price_changed=false;
+//    //    sqlite3* db=[iSalesDB get_db];
+//    //    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    //    NSNumber* default_price = [self get_model_default_price:appDelegate.contact_id product_id:nil item_id:_id db:db];
+//    //    NSRange range;
+//    //    range = [notes rangeOfString:@"PRICE MODIFIED"];
+//    //
+//    //    if((default_price.doubleValue!=price.doubleValue || discount.intValue!=0 ) && range.location == NSNotFound)
+//    //        badd_price_changed=true;
+//    //    [iSalesDB close_db:db];
+//    //
+//    //    if(badd_price_changed)
+//    //    {
+//    //        notes=[NSString stringWithFormat:@"%@\n%@",@"PRICE MODIFIED",notes];
+//    //    }
+//    //
+//
+//
+////    price = [self translateSingleQuote:[AESCrypt fastencrypt:price]];
+//
+//    NSString *sql = [NSString stringWithFormat:@"update offline_cart set discount = %f  where so_no = '%@'",discount.doubleValue,order_code];
+//
+//    int ret = [iSalesDB execSql:sql];
+//
+//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+//    [dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
+//    [dic setValue:@"Regular Mode" forKey:@"mode"];
+//    //    [dic setValue:@"160409" forKey:@"min_ver"];
+//
+////    return [RAConvertor dict2data:dic];
+//    return dic;
+//
+//}
+
+
++(NSDictionary*) offline_setorderdiscount :(NSMutableDictionary *) params
 {
-    DebugLog(@"cart set price params: %@",params);
+    DebugLog(@"order set discount params: %@",params);
     //    "cartitem_id" = 1;
     //    discount = "0.000000";
     //    "item_note" = "";

+ 2 - 0
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -348,6 +348,8 @@
                         
                     
         [ActiveViewController Notify:@"ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
+                        
+        [ActiveViewController Notify:@"ScanSearchViewController,ScanHistoryViewController" Message:RA_NOTIFICATION_REFRESH_UI];
                     
 #endif
                         

+ 3 - 2
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -7416,7 +7416,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
     if(appDelegate.offline_mode)
     {
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            NSMutableDictionary* json = [[OLDataProvider offline_cartsetallprice:params] mutableCopy];
+            NSMutableDictionary* json = [[OLDataProvider offline_setorderdiscount:params] mutableCopy];
             dispatch_async(dispatch_get_main_queue(), ^{
                 result(json);
             });
@@ -10393,6 +10393,7 @@ NSString *const ScreenCodeOfflineSync = @"Offline Sync Screen";
     //        return nil;
     
 }
+#ifdef SCANNER_ORDER
 +(void) request_scan_bulkdiscount:(float) discount notes:(NSString*) notes completionHandler:(resultHandler)result
 {
 //        appDelegate.cart_count = [[RASingleton.sharedInstance.scan_cart valueForKey:@"cart_count"] intValue];
@@ -10434,7 +10435,7 @@ NSMutableDictionary* section = [RASingleton.sharedInstance.scan_cart[@"section_0
     [OLDataProvider updateScanOrder:appDelegate.order_code];
     return;
 }
-
+#endif
 +(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];

+ 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>3</integer>
 		</dict>
 		<key>iSales-USAI.xcscheme_^#shared#^_</key>
 		<dict>

+ 1 - 1
RedAnt ERP Mobile/iSales-CONTRAST/config.h

@@ -20,7 +20,7 @@
 #define RA_NOTIFICATION
 
 # ifdef DEBUG
-//#define test_server
+#define test_server
 # endif
 
 #define exception_switch 1