Jelajahi Sumber

1.将部分宏定义BUILD_GATIT的判断和宏定义BUILD_HOMER合并。
2.修改CommonEditor,增加输入最大值和最小值限制判断。
3.修改Order Editor,检查Front和Next越界。
4.修复NPD Order Review Switch To Order List时导航栏消失。

Pen Li 8 tahun lalu
induk
melakukan
4acf53152a

+ 132 - 1
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -637,7 +637,92 @@
                         }
                     }
                     else if([itemjson valueForKey:@"value"]!=nil && ![[itemjson valueForKey:@"value"]isEqualToString:@""] )
-                        [upparams setValue:[itemjson valueForKey:@"value"] forKey:[itemjson valueForKey:@"name"]];
+                    {
+                        NSString *keyboard_type = [itemjson objectForKey:@"keyboard"];
+                        BOOL check_max = [itemjson objectForKey:@"max_type"] != nil ? YES : NO;
+                        BOOL check_min = [itemjson objectForKey:@"min_type"] != nil ? YES : NO;
+                        if ([keyboard_type isEqualToString:@"number"] && (check_max || check_min)) {
+                            // 检查最大值最小值
+                            int max_type = [[itemjson objectForKey:@"max_type"] intValue];
+                            int min_type = [[itemjson objectForKey:@"min_type"] intValue];
+                            
+                            float max_value = MAXFLOAT;
+                            float min_value = 0;
+                            
+                            NSString *mfield = nil;
+                            float f_value = [check_len_val floatValue];
+                            
+                            if (check_max) {
+                                
+                                if (max_type > 0) {
+                                    // key
+                                    NSString *max_key = [itemjson objectForKey:@"max"];
+                                    id max_obj = [self downloadValueForKey:max_key];
+                                    if (max_obj) {
+                                        max_value = [max_obj floatValue];
+                                    }
+                                    
+                                } else {
+                                    // value
+                                    id max_obj = [itemjson objectForKey:@"max"];
+                                    if (max_obj != nil) {
+                                        max_value = [max_obj floatValue];
+                                    }
+                                    
+                                }
+                                
+                                if (max_value < f_value) {
+                                    mfield =[NSString stringWithFormat:@"%ld. the value of %@ must be not larger than %.2f",fields.count+1,itemjson[@"aname"],max_value];
+                                }
+                            }
+                            
+                            if (check_min) {
+                                
+                                if (min_type > 0) {
+                                    // key
+                                    NSString *min_key = [itemjson objectForKey:@"min"];
+                                    id min_obj = [self downloadValueForKey:min_key];
+                                    if (min_obj) {
+                                        min_value = [min_obj floatValue];
+                                    }
+                                } else {
+                                    // value
+                                    id min_obj = [itemjson objectForKey:@"min"];
+                                    if (min_obj != nil) {
+                                        min_value = [min_obj floatValue];
+                                    }
+                                }
+                                
+                                if (min_value > f_value) {
+                                    mfield =[NSString stringWithFormat:@"%ld. the value of %@ must be not smaller than %.2f",fields.count+1,itemjson[@"aname"],min_value];
+                                }
+                            }
+                            
+                            
+                            if (check_min && check_max) {
+                                if (f_value < min_value || f_value > max_value) {
+                                    mfield =[NSString stringWithFormat:@"%ld. the value of %@ must between %.2f and %.2f",fields.count+1,itemjson[@"aname"],min_value,max_value];
+                                }
+                            }
+                            
+                            if (mfield != nil) {
+                                
+                                [fields addObject:mfield];
+                                NSIndexPath* indexpath =[self get_indexpath1:[itemjson valueForKey:@"name"]];
+                                if(alert)
+                                    [self unhide_section:(int)indexpath.section];
+                                if(fields.count==1)
+                                {
+                                    self.first_miss_pos =  indexpath;
+                                    
+                                }
+                            }
+                            
+                        } else {
+                            [upparams setValue:[itemjson valueForKey:@"value"] forKey:[itemjson valueForKey:@"name"]];
+                        }
+                        
+                    }
                     else
                     {
                         if([[itemjson valueForKey:@"required"] isEqualToString: @"true"] )
@@ -2010,6 +2095,52 @@
     }
     return ret;
 }
+
+- (id)downloadValueForKey:(NSString *)key_name {
+    __block id ret=nil;
+    [self.content_data_download enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
+        
+        if (![key isEqualToString:@"section_count"] && [key hasPrefix:@"section_"]) {
+            
+            NSDictionary *section = (NSDictionary *)obj;
+            
+            [section enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull item_key, id  _Nonnull item_obj, BOOL * _Nonnull stop) {
+                
+                if ([item_key hasPrefix:@"item_"]) {
+                    
+                    NSDictionary* item= (NSDictionary *)item_obj;
+                    NSString* item_name=[item valueForKey:@"name"];
+                    if([item_name isEqualToString:key_name])
+                    {
+                        NSString* control = [item valueForKey:@"control"];
+                        
+                        if([control isEqualToString:@"enum"])
+                        {
+                            NSDictionary* cadedate = [item objectForKey:@"cadedate"];
+                            int cc = [[cadedate valueForKey:@"count"] intValue];
+                            for(int l=0;l<cc;l++)
+                            {
+                                NSDictionary* val_json=[cadedate objectForKey:[NSString stringWithFormat:@"val_%d",l]];
+                                if([[val_json valueForKey:@"check"]intValue]==1)
+                                    ret = [val_json valueForKey:@"value_id"];
+                            }
+                            
+                        }
+                        else
+                            
+                            ret = [item valueForKey:@"value"];
+                    }
+                    
+                }
+                
+            }];
+            
+        }
+        
+    }];
+    return ret;
+}
+
 -(void) setValue:(NSString*)key value:(NSString*)val
 {
     // NSString* ret=nil;

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

@@ -1748,7 +1748,7 @@
     
 # endif
     
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
 /*    
     if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
     {
@@ -1775,33 +1775,6 @@
     
 # endif
     
-#ifdef BUILD_GATIT
-/*
-    if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
-    {
-        [map setValue:@"Offline Setting" forKey:@"title"];
-        [map setValue:@"rect_market_news" forKey:@"img"];
-        [self.sideMenuItems addObject:map.copy];
-        
-    }
-*/
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
-        [map setValue:@"Price Setting" forKey:@"title"];
-        //        [map setValue:@"rect_market_news" forKey:@"img"];
-        [self.sideMenuItems addObject:map.copy];
-    }
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
-        if ([Singleton sharedInstance].global_lock) {
-            [map setValue:@"Unlock" forKey:@"title"];
-        } else {
-            [map setValue:@"Lock" forKey:@"title"];
-        }
-        
-        [self.sideMenuItems addObject:map.copy];
-    }
-    
-# endif
-    
 //    if([[appDelegate.user lowercaseString] isEqualToString:@"larryl"]||[[appDelegate.user lowercaseString] isEqualToString:@"arpithat"])
 //    {
 //        //        [map setValue:@"Contact" forKey:@"title"];

+ 1 - 10
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -2531,16 +2531,7 @@
         }
 #endif
         
-#ifdef BUILD_HOMER
-#ifdef OFFLINE_MODE
-        condition = !appDelegate.offline_mode && outOfStock;
-#endif
-        if (condition) {
-            [arr addObject:notifyMeAction];
-        }
-#endif
-        
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
 #ifdef OFFLINE_MODE
         condition = !appDelegate.offline_mode && outOfStock;
 #endif

+ 1 - 30
RedAnt ERP Mobile/common/Functions/category/CategorySearchFilterViewController.m

@@ -550,7 +550,7 @@
     DebugLog(@"menu select %@",data);
 #endif
     
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     NSDictionary *data = item;
     int count = [[data valueForKey:@"count"] intValue];
     if(count==0)
@@ -577,35 +577,6 @@
     DebugLog(@"menu select %@",data);
 #endif
     
-#ifdef BUILD_GATIT
-    NSDictionary *data = item;
-    int count = [[data valueForKey:@"count"] intValue];
-    if(count==0)
-    {
-        
-        
-        NSString* _id =  [data valueForKey:@"id"];
-        
-        NSDictionary* ddd=[self check:_id source:[self.categoryMenu mutableCopy]];
-        self.categoryMenu=ddd;
-        UITableViewCell *cell = (UITableViewCell *)[self.treeView cellForItem:item];
-        
-        
-        
-        int check=[self is_check:_id source:self.categoryMenu];
-        if(check==1)
-            cell.accessoryType = UITableViewCellAccessoryCheckmark;
-        else
-            cell.accessoryType=UITableViewCellAccessoryNone;
-        
-        
-        
-    }
-    DebugLog(@"menu select %@",data);
-#endif
-    
-    
-    
 }
 
 //- (void)treeView:(RATreeView *)treeView willDisplayCell:(UITableViewCell *)cell forItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo

+ 2 - 13
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -224,20 +224,8 @@
         
         self.categoryid = ids;
 #endif
-#ifdef BUILD_HOMER
-        NSArray *idArr = [ids componentsSeparatedByString:@","];
-        if (idArr.count == 1) {
-            self.categoryString = [@"Category" stringByAppendingString:[self categoryString:ids node:menu level:0]];
-        } else {
-            self.categoryString = @"Category>Multiple Category>";
-        }
         
-        
-        self.cagegoryLabel.text =self.categoryString;
-        
-        self.categoryid = ids;
-#endif
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
         NSArray *idArr = [ids componentsSeparatedByString:@","];
         if (idArr.count == 1) {
             self.categoryString = [@"Category" stringByAppendingString:[self categoryString:ids node:menu level:0]];
@@ -250,6 +238,7 @@
         
         self.categoryid = ids;
 #endif
+
         self.modelname = modelname;
         self.modeldescrip = modeldescrip;
         self.p_alert=alert;

+ 6 - 148
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -30,7 +30,7 @@
 
 #import "ModelDescriptionController.h"
 
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
 #import "HomerModelDetailHeaderCell.h"
 #endif
 
@@ -336,7 +336,7 @@ self.isrefreshing=false;
     // Do any additional setup after loading the view.
     
     
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     [self.detailTable registerNib:[UINib nibWithNibName:@"HomerModelDetailHeaderCell" bundle:nil] forCellReuseIdentifier:@"HomerModelDetailHeaderCell"];
 #endif
     
@@ -1031,7 +1031,7 @@ self.isrefreshing=false;
     
     if(indexPath.section==0)
     {
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
         NSString *CellIdentifier = @"HomerModelDetailHeaderCell";
         HomerModelDetailHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
 #else
@@ -1051,7 +1051,7 @@ self.isrefreshing=false;
             
             cell.btnaddPortfolio.hidden = YES;
             cell.btnNotifyMe.hidden = YES;
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
             cell.hmlg_stock_lb.hidden = NO;
             cell.hmlg_stock_count_lb.hidden = NO;
             id hmlg_stock = [section_json objectForKey:@"hmlg_avalability"];
@@ -1205,7 +1205,7 @@ self.isrefreshing=false;
                 
             }
 #endif
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
             
             cell.hmlg_stock_lb.hidden = NO;
             cell.hmlg_stock_count_lb.hidden = NO;
@@ -1357,148 +1357,6 @@ self.isrefreshing=false;
             }
 #endif
             
-#ifdef BUILD_GATIT
-            NSString *qtyStr = [section_json valueForKey:@"Availability"];
-            
-            __weak typeof(self) weakself = self;
-            cell.notifyMeBlock = ^{
-                
-                UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
-                dispatch_async(dispatch_get_global_queue(0,0), ^{
-                    
-                    NSDictionary *dic = [RANetwork notifyModel:self.product_id emailAddr:nil withScreen:ScreenCodeModelInfo];
-                    
-                    dispatch_async(dispatch_get_main_queue(), ^{
-                        
-                        [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
-                        
-                        NSInteger result = [[dic valueForKey:@"result"] integerValue];
-                        
-                        if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
-                            
-                            NSString *msg = [NSString stringWithFormat:@"The email send failed"];
-                            
-                            if ([dic valueForKey:@"err_msg"]) {
-                                msg = [dic valueForKey:@"err_msg"];
-                            }
-                            
-                            
-                            UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                            UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-                                
-                            }];
-                            
-                            [errorAlertVC addAction:action];
-                            [weakself presentViewController:errorAlertVC animated:YES completion:nil];
-                            
-                        } else if (result == RESULT_TRUE){
-                            
-                            [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
-                            
-                        } else if (result == RESULT_NO_EMAIL_ADDRESS) {
-                            
-                            [self showEmailAddrBox];
-                            
-                        }
-                    });
-                    
-                    
-                });
-                
-                
-            };
-            
-            
-            if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
-                
-                cell.btnaddPortfolio.hidden = YES;
-                
-                if (!notifyMe_switch) {
-                    
-                    cell.btnNotifyMe.hidden = YES;
-                    
-                } else {
-                    
-                    
-                    cell.btnNotifyMe.hidden = NO;
-                    
-                    
-                    if (!appDelegate.order_code) { // 未打开订单状态
-                        
-                        if ([self isOutofStock]) {
-                            
-                            if (!appDelegate.can_create_backorder) {
-                                cell.btnaddCart.enabled = NO;
-                            }
-                            cell.btnNotifyMe.enabled = YES;
-                            
-                        } else {
-                            
-                            cell.btnaddCart.enabled = YES;
-                            cell.btnNotifyMe.enabled = NO;
-                        }
-                        
-                    } else {
-                        // 打开订单状态
-                        if (![Singleton sharedInstance].currentOrderIsMerged) {
-                            // Shop Order
-                            cell.btnaddCart.enabled = YES;
-                            // 默认未缺货
-                            cell.btnNotifyMe.enabled = NO;
-                            
-                            if ([self isOutofStock]) { // 缺货
-                                
-                                cell.btnNotifyMe.enabled = YES;
-                                
-                            }
-                            
-                        } else {
-                            // Purchase Order
-                            if ([self isOutofStock]) { // 缺货
-                                if (!appDelegate.can_create_backorder) {
-                                    cell.btnaddCart.enabled = NO;
-                                }
-                                cell.btnNotifyMe.enabled = YES;
-                            } else { // 未缺货
-                                cell.btnNotifyMe.enabled = NO;
-                                cell.btnaddCart.enabled = YES;
-                            }
-                            
-                        }
-                        
-                        
-                    }
-                    
-                    
-                }
-                
-            } else { // employee
-                
-                // online
-                cell.btnaddPortfolio.hidden = NO;
-                cell.btnNotifyMe.hidden = NO;
-                
-                if ([self isOutofStock]) { // 缺货
-                    if (!appDelegate.can_create_backorder) {
-                        cell.btnaddCart.enabled = NO;
-                    }
-                    cell.btnNotifyMe.enabled = YES;
-                } else { // 未缺货
-                    cell.btnNotifyMe.enabled = NO;
-                    cell.btnaddCart.enabled = YES;
-                    
-                }
-                
-                // offline
-#ifdef OFFLINE_MODE
-                if (appDelegate.offline_mode) {
-                    cell.btnNotifyMe.hidden = YES;
-                }
-#endif
-                
-            }
-#endif
-            
             
 #ifdef BUILD_HMLG
             cell.btnaddPortfolio.hidden = NO;
@@ -1592,7 +1450,7 @@ self.isrefreshing=false;
             price=nil;
         }
         }
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
         NSString *old_price = [section_json objectForKey:@"old_price"];
         if (appDelegate.user && old_price != nil && old_price.length > 0) {
             cell.priceLabel.text = nil;

+ 1 - 5
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -4155,15 +4155,11 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
             weight= uweight*count;
 #endif
             
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
             cuft=ucbf*count;
             weight= uweight*count;
 #endif
             
-#ifdef BUILD_GATIT
-            cuft=ucbf*count;
-            weight= uweight*count;
-#endif
         }
         
         

+ 20 - 610
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -391,8 +391,8 @@
     }
 #endif
     
-#ifdef BUILD_HOMER
-    subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,so];
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
+    subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,so,COMPANY_NAME];
     
     if (appDelegate.user_type == USER_ROLE_CUSTOMER&&self.is_shoporder) {
         NSString *companyName = [appDelegate.customerInfo objectForKey:@"customer_name"];
@@ -400,14 +400,6 @@
     }
 #endif
     
-#ifdef BUILD_GATIT
-    subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,so];
-    
-    if (appDelegate.user_type == USER_ROLE_CUSTOMER&&self.is_shoporder) {
-        NSString *companyName = [appDelegate.customerInfo objectForKey:@"customer_name"];
-        subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,so,companyName];
-    }
-#endif
     
 #ifdef BUILD_HMLG
     
@@ -690,7 +682,7 @@
                             }
 #endif
                             
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
                             int count = [[self.content_data objectForKey:@"count"] intValue];
                             for (int i = 0; i < count; i++) {
                                 NSString *key = [NSString stringWithFormat:@"section_%d",i];
@@ -704,19 +696,6 @@
                             }
 #endif
                             
-#ifdef BUILD_GATIT
-                            int count = [[self.content_data objectForKey:@"count"] intValue];
-                            for (int i = 0; i < count; i++) {
-                                NSString *key = [NSString stringWithFormat:@"section_%d",i];
-                                NSMutableDictionary *section = [[self.content_data objectForKey:key] mutableCopy];
-                                NSString *type = [section objectForKey:@"type"];
-                                if ([type isEqualToString:@"sign_url"]) {
-                                    [section setObject:img_url_down forKey:@"data"];
-                                    [self.content_data setObject:section forKey:key];
-                                    break;
-                                }
-                            }
-#endif
                             
 #ifdef BUILD_HMLG
                         
@@ -791,20 +770,7 @@
                                 }
 #endif
                                 
-#ifdef BUILD_HOMER
-                                int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
-                                for (int i = 0; i < count; i++) {
-                                    NSString *key = [NSString stringWithFormat:@"section_%d",i];
-                                    NSMutableDictionary *section = [[weakSelf.content_data objectForKey:key] mutableCopy];
-                                    NSString *type = [section objectForKey:@"type"];
-                                    if ([type isEqualToString:@"sign_url"]) {
-                                        [section setObject:img_url_down forKey:@"data"];
-                                        [weakSelf.content_data setObject:section forKey:key];
-                                        break;
-                                    }
-                                }
-#endif
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
                                 int count = [[weakSelf.content_data objectForKey:@"count"] intValue];
                                 for (int i = 0; i < count; i++) {
                                     NSString *key = [NSString stringWithFormat:@"section_%d",i];
@@ -1409,52 +1375,7 @@
     
 #endif
     
-#ifdef BUILD_HOMER
-    NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
-    NSDictionary *data = [section_item objectForKey:@"data"];
-    NSString *type = [section_item objectForKey:@"type"];
-    if ([type isEqualToString:@"order_info"]) {
-        
-        float height= self.web_info_height;
-        if(height==0)
-            height=DEF_TABLE_HEIGHT;
-        
-        return height;
-        
-    } else if ([type isEqualToString:@"sign_url"]) {
-        return 148;
-    } else if ([type isEqualToString:@"more_order_info"]) {
-        
-        float height= self.web_moreinfo_height;
-        if(height==0)
-            height=DEF_TABLE_HEIGHT;
-        
-        return height;
-        
-    } else if ([type isEqualToString:@"sub_order"]) {
-        
-        NSDictionary *item = [data objectForKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
-        NSString *item_type = [item objectForKey:@"type"];
-        if ([item_type isEqualToString:@"pick_info"]) {
-            return 218;
-        } else {
-            NSString* notes =[item valueForKey:@"note"];
-            if(notes.length>0)
-            {
-                return 190;
-            }
-            else
-                return 162;
-        }
-        
-        
-    } else if ([type isEqualToString:@"price_info"]) {
-        return 44;
-    }
-    
-#endif
-    
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
     NSDictionary *data = [section_item objectForKey:@"data"];
     NSString *type = [section_item objectForKey:@"type"];
@@ -1658,51 +1579,7 @@
     
 #endif
     
-#ifdef BUILD_HOMER
-    NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]];
-    NSString *title = [section_item objectForKey:@"title"];
-    labeltitle = title;
-    if ([title isEqualToString:@"More Info"]) {
-        
-        NSString* btntitle=nil ;
-        if(self.showMore)
-        {
-            btntitle=@"Hide";
-        }
-        else{
-            btntitle=@"Show";
-        }
-        
-        
-        UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
-        btn.tag=section;
-        [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
-        [btn setTitle:btntitle forState:UIControlStateNormal];
-        btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
-        [myView addSubview:btn];
-        
-    } else if ([title containsString:@"Models"]) {
-        
-        BOOL item_switch = [[section_item objectForKey:@"switch"] boolValue];
-        NSString *normalTitle = @"Show";
-        NSString *selectedTitle = @"Hide";
-        if (item_switch == YES) {
-            normalTitle = @"Hide";
-            selectedTitle = @"Show";
-        }
-        
-        UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
-        btn.tag=section;
-        [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
-        [btn setTitle:normalTitle forState:UIControlStateNormal];
-        [btn setTitle:selectedTitle forState:UIControlStateSelected];
-        btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
-        [myView addSubview:btn];
-    }
-    
-#endif
-    
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]];
     NSString *title = [section_item objectForKey:@"title"];
     labeltitle = title;
@@ -1867,36 +1744,7 @@
     
 #endif
     
-#ifdef BUILD_HOMER
-    NSUInteger section = sender.tag;
-    NSMutableDictionary *section_item = [[self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]] mutableCopy];
-    NSString *title = [section_item objectForKey:@"title"];
-    
-    if ([title isEqualToString:@"More Info"]) {
-        
-        self.showMore = !self.showMore;
-        NSRange range = NSMakeRange(section, 1);
-        NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
-        [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
-        
-    } else if ([title containsString:@"Models"]) {
-        
-        BOOL item_switch = [[section_item objectForKey:@"switch"] boolValue];
-        if (item_switch == YES) {
-            [section_item setObject:@(NO) forKey:@"switch"];
-        } else {
-            [section_item setObject:@(YES) forKey:@"switch"];
-        }
-        [self.content_data setObject:section_item forKey:[NSString stringWithFormat:@"section_%ld",section]];
-        
-        sender.selected = !sender.selected;
-        NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndex:section];
-        [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
-    }
-    
-#endif
-    
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     NSUInteger section = sender.tag;
     NSMutableDictionary *section_item = [[self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]] mutableCopy];
     NSString *title = [section_item objectForKey:@"title"];
@@ -1980,11 +1828,7 @@
     return [[self.content_data objectForKey:@"count"] integerValue];
 #endif
     
-#ifdef BUILD_HOMER
-    return [[self.content_data objectForKey:@"count"] integerValue];
-#endif
-    
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     return [[self.content_data objectForKey:@"count"] integerValue];
 #endif
     
@@ -2034,43 +1878,7 @@
     
 #endif
     
-#ifdef BUILD_HOMER
-    
-    NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]];
-    NSDictionary *data = [section_item objectForKey:@"data"];
-    NSString *section_type = [section_item objectForKey:@"type"];
-    if ([section_type isEqualToString:@"sub_order"]) {
-        
-        BOOL item_switch = [[section_item objectForKey:@"switch"] boolValue];
-        if (item_switch == YES) {
-            return [[data objectForKey:@"count"] integerValue];
-        } else {
-            return 0;
-        }
-        
-        
-    } else if ([section_type isEqualToString:@"order_info"]){
-        if (self.showModels) {
-            return 1;
-        } else {
-            return 0;
-        }
-    } else if ([section_type isEqualToString:@"sign_url"]){
-        return 1;
-    } else if ([section_type isEqualToString:@"more_order_info"]){
-        if(self.showMore)
-            return 1;
-        else
-            return 0;
-    }else if ([section_type isEqualToString:@"price_info"]){
-        return [[data objectForKey:@"count"] integerValue];
-    }
-    
-    return 0;
-    
-#endif
-    
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     
     NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]];
     NSDictionary *data = [section_item objectForKey:@"data"];
@@ -2133,11 +1941,7 @@
         return 6;
 #endif
         
-#ifdef BUILD_HOMER
-        return 6;
-#endif
-        
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
         return 6;
 #endif
         
@@ -2545,7 +2349,7 @@
     
 #endif
     
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     /**
      * ver1.90
      */
@@ -2931,401 +2735,14 @@
     
 #endif
     
-#ifdef BUILD_GATIT
-    /**
-     * ver1.90
-     */
-    NSDictionary *section = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
-    NSString *type = [section objectForKey:@"type"];
+#ifdef BUILD_HMLG
     
-    if ([type isEqualToString:@"order_info"]) {/** Order Info */
-        
-        NSString *CellIdentifier = @"OrderDetailHtmlCell";
-        OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
-        
-        
-        
-        
-        
-        cell.webview.tag = indexPath.section;
-        
-        cell.webview.delegate = self;
-        //        cell.webView.scrollView.contentSize.height = 0;
-        cell.webview.scrollView.bounces=NO;
-        cell.webview.scrollView.directionalLockEnabled = true;
-        CGSize size= cell.webview.scrollView.contentSize;
-        size.height=10;
-        cell.webview.scrollView.contentSize=size;
-        
-        [cell.webview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
-        
-        cell.backgroundColor = [UIColor whiteColor];
-        return cell;
-    } else if ([type isEqualToString:@"sign_url"]) { /** Sign */
-        
-        
-        NSString *CellIdentifier = @"OrderDetailSignatureCell";
-        OrderDetailSignatureCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
-        NSString* img_url = [section valueForKey:@"data"];
-        
-        cell.sign_img.userInteractionEnabled = NO;
-        __block BOOL hasTapGesture = NO;
-        [cell.sign_img.gestureRecognizers enumerateObjectsUsingBlock:^(__kindof UIGestureRecognizer * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-            
-            if ([obj isKindOfClass:[UITapGestureRecognizer class]]) {
-                hasTapGesture = YES;
-                *stop = YES;
-            }
-            
-        }];
-        
-        if (!hasTapGesture) {
-            UITapGestureRecognizer *signatureTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onSignOrderClick:)];
-            [cell.sign_img addGestureRecognizer:signatureTap];
-        }
-        
-        int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
-        bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
-        if(status_code==1) {
+    switch(indexPath.section)
+    {
+        case 0:
+        {
             
-            BOOL condition = offline_edit;
-#ifdef OFFLINE_MODE
-            condition = condition || appDelegate.offline_mode==false;
-#else
-            condition = YES;
-#endif
-            if (condition)
-            {
-                cell.sign_img.userInteractionEnabled = YES;
-            }
-            
-        }
-        else if(status_code==0) {
-            BOOL condition = offline_edit;
-#ifdef OFFLINE_MODE
-            condition = condition || appDelegate.offline_mode==false;
-#else
-            condition = YES;
-#endif
-            if (condition)
-            {
-                cell.sign_img.userInteractionEnabled = YES;
-            }
-        }
-        
-        
-        
-        NSString* file_name=[img_url lastPathComponent];
-        NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
-        if(img_data!=nil)
-        {
-            
-            UIImage * img =[UIImage imageWithData:img_data];
-            cell.sign_img.image=img ;
-        }
-        else
-        {
-            
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                
-                NSData*  downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    
-                    
-                    
-                    if(downloadimg_data!=nil)
-                    {
-                        
-                        [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
-                        
-                        UIImage * img =[UIImage imageWithData:downloadimg_data];
-                        cell.sign_img.image=img ;
-                    }
-                    else {
-                        if (cell.sign_img.userInteractionEnabled) {
-                            cell.sign_img.image=[UIImage imageNamed:@"taptosign_s"];
-                        } else {
-                            cell.sign_img.image = nil;
-                        }
-                    }
-                    
-                    
-                });
-            });
-            
-            
-        }
-        cell.backgroundColor = [UIColor whiteColor];
-        return cell;
-    } else if ([type isEqualToString:@"more_order_info"]) { /** More Info */
-        
-        NSString *CellIdentifier = @"OrderDetailHtmlCell";
-        OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
-        
-        
-        
-        
-        cell.webview.tag = indexPath.section;
-        cell.webview.delegate = self;
-        //        cell.webView.scrollView.contentSize.height = 0;
-        cell.webview.scrollView.bounces=NO;
-        cell.webview.scrollView.directionalLockEnabled = true;
-        CGSize size= cell.webview.scrollView.contentSize;
-        size.height=10;
-        cell.webview.scrollView.contentSize=size;
-        
-        
-        
-        [cell.webview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
-        
-        cell.backgroundColor = [UIColor whiteColor];
-        return cell;
-        
-    } else if ([type isEqualToString:@"sub_order"]) { /** Sub Order */
-        
-        NSDictionary *data = [section objectForKey:@"data"];
-        NSDictionary *item = [data objectForKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
-        NSString *item_type = [item objectForKey:@"type"];
-        
-        if ([item_type isEqualToString:@"pick_info"]) { /** Pick Info */
-            
-            NSString *CellIdentifier = @"OrderDetailPickInfoCell";
-            OrderDetailPickInfoCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
-            
-            NSString *carrier = [item objectForKey:@"delivery_carrier"];
-            NSString *web_url = [item objectForKey:@"delivery_web_url"];
-            NSString *track_number = [item objectForKey:@"tracking_number"];
-            NSString *status = [item objectForKey:@"status"];
-            
-            cell.track_number_lb.text = track_number;
-            cell.status_lb.text = status;
-            cell.carrier_lb.text = carrier;
-            cell.url_lb.text = web_url;
-            
-            return cell;
-            
-        } else if ([item_type isEqualToString:@"order_item"]) { /** Item Info */
-            
-            NSString *CellIdentifier = @"OrderDetailModelCell";
-            OrderDetailModelCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
-            NSDictionary * item_json = item;
-            
-            //            int count = [[item_json valueForKey:@"count"] intValue];
-            NSDictionary * combine_json =[item_json objectForKey:@"combine"];
-            cell.bundle_item=combine_json;
-            NSDictionary * master_json = [item_json objectForKey:@"combine_master"];
-            if (cell.masterBtn != nil) {
-                if (master_json == nil) {
-                    cell.masterBtn.hidden = YES;
-                } else{
-                    cell.masterBtn.hidden = NO;
-                    cell.master_items = master_json;
-                }
-            }
-            
-            double dprice=0.0;
-            
-            if(cell.bundle_item!=nil)
-            {
-                int citem=0;
-                
-                int bcount=[[cell.bundle_item valueForKey:@"count"] intValue];
-                for(int bc=0;bc<bcount;bc++)
-                {
-                    NSDictionary * bitem = [cell.bundle_item objectForKey:[NSString stringWithFormat:@"item_%d",bc]];
-                    int modulus= [[bitem valueForKey:@"modulus"] intValue];
-                    citem+= modulus;
-                    double uprice= [[bitem valueForKey:@"unit_price"]doubleValue];
-                    dprice+= uprice*modulus;
-                    
-                }
-                if(citem==1)
-                    [ cell.buttonBundle setTitle:[NSString stringWithFormat: @"%d bundle item with price of $ %.2f",citem,dprice ]forState:UIControlStateNormal];
-                else
-                    [ cell.buttonBundle setTitle:[NSString stringWithFormat: @"%d bundle items with price of $ %.2f",citem,dprice ]forState:UIControlStateNormal];
-                
-                cell.buttonBundle.hidden = NO;
-            }
-            else
-            {
-                cell.buttonBundle.hidden = YES;
-                
-            }
-            
-            
-            
-            NSString* img_url = [item_json valueForKey:@"img"];
-            NSString* description = [item_json valueForKey:@"Item Number"];
-            
-            NSString* unitprice = [item_json valueForKey:@"The unit price"];
-            NSString* origin_price = [item_json valueForKey:@"origin_price"];
-            NSString* subtotal = [item_json valueForKey:@"Subtotal"];
-            NSString* qty = [item_json valueForKey:@"QTY"];
-            NSString* status = [item_json valueForKey:@"order_item_status"];
-            NSString* notes = [item_json valueForKey:@"note"];
-            
-            if(notes.length>0)
-            {
-                cell.noteLabel.text = [@"Note: " stringByAppendingString:[notes stringByReplacingOccurrencesOfString:@"\n" withString:@" "]];
-            }
-            else
-                cell.noteLabel.text = nil;
-            if(appDelegate.can_see_price&&appDelegate.price_hidden==false)
-            {
-                
-            }
-            else
-            {
-                unitprice=nil;
-                origin_price=nil;
-                subtotal=nil;
-            }
-            
-            float duprice = [unitprice floatValue];
-            float dsubtotal = (duprice+dprice)*[qty intValue];
-            
-            cell.descriptionLabel.text=description;
-            if(dprice>0)
-                cell.unitpriceLabel.text = [NSString stringWithFormat:@"%.2f+%.2f",duprice,dprice];//unitprice;
-            else
-                cell.unitpriceLabel.text = [NSString stringWithFormat:@"%.2f",duprice];//unitprice;
-            cell.subtotalLabel.text = [NSString stringWithFormat:@"%.2f",dsubtotal];//subtotal;
-            cell.qtyLabel.text = qty;
-            cell.statusLabel.text = status;
-            
-            
-            cell.labelOldPrice.text = origin_price;
-            
-            double discount =[[item_json valueForKey:@"discount"] doubleValue];
-            NSString* discountstr=[NSString stringWithFormat:@"%@%% off", [RAUtils FloatFormat:discount]];
-            cell.labelDiscount.text = discountstr;
-            bool isfree = [[item_json valueForKey:@"is_free"]boolValue];
-            if(isfree)
-            {
-                cell.labelOldPrice.hidden = false;
-                cell.labelOldPrice.textColor = [UIColor redColor];
-                cell.labelOldPrice.text=@"Free";
-                cell.labelOldPrice.hideline = true;
-                
-                cell.labelDiscount.hidden = true;
-            }
-            else
-            {
-                cell.labelOldPrice.textColor = [UIColor blackColor];
-                cell.labelOldPrice.hideline = false;
-                if(discount==0)
-                {
-                    cell.labelOldPrice.hidden = true;
-                    cell.labelDiscount.hidden = true;
-                    
-                }
-                else
-                {
-                    cell.labelOldPrice.hidden = false;
-                    cell.labelDiscount.hidden = false;
-                }
-            }
-            
-            // Button 设置了大小约束,Size就不会随内容变化
-            [cell.imgbtn setContentMode:UIViewContentModeScaleAspectFit];
-            [cell.imgbtn setContentEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
-            [cell.imgbtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentFill];
-            [cell.imgbtn setContentVerticalAlignment:UIControlContentVerticalAlignmentFill];
-            cell.imgbtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
-            
-            if (![cell.imageName isEqualToString:img_url]) {
-                cell.imageName = img_url;
-//                [cell.imgbtn setBackgroundImage:[UIImage imageNamed:@"loading_s"] forState:UIControlStateNormal];
-                [cell.imgbtn setImage:[UIImage imageNamed:@"loading_s"] forState:UIControlStateNormal];
-                
-                NSString* file_name=[img_url lastPathComponent];
-                NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
-                if(img_data!=nil)
-                {
-                    
-                    UIImage * img =[UIImage imageWithData:img_data];
-//                    [cell.imgbtn setBackgroundImage:img forState:UIControlStateNormal];
-                    [cell.imgbtn setImage:img forState:UIControlStateNormal];
-                }
-                else
-                {
-                    
-                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                        
-                        NSData*  downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
-                        
-                        dispatch_async(dispatch_get_main_queue(), ^{
-                            
-                            
-                            
-                            if(downloadimg_data!=nil)
-                            {
-                                
-                                [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
-                                
-                                UIImage * img =[UIImage imageWithData:downloadimg_data];
-//                                [cell.imgbtn setBackgroundImage:img forState:UIControlStateNormal];
-                                [cell.imgbtn setImage:img forState:UIControlStateNormal];
-                            }
-                            else
-//                                [cell.imgbtn setBackgroundImage:[UIImage imageNamed:@"notfound_s"] forState:UIControlStateNormal];
-                                [cell.imgbtn setImage:[UIImage imageNamed:@"notfound_s"] forState:UIControlStateNormal];
-                            
-                            
-                        });
-                    });
-                    
-                    
-                }
-            }
-            
-            cell.backgroundColor = [UIColor whiteColor];
-            return cell;
-            
-            
-        }
-        
-        
-    } else if ([type isEqualToString:@"price_info"]) { /** Price */
-        
-        NSString *CellIdentifier = @"OrderDetailPriceCell";
-        OrderDetailPriceCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
-        
-        NSDictionary *data = [section objectForKey:@"data"];
-        NSDictionary *item = [data objectForKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
-        NSString *title = [item objectForKey:@"title"];
-        NSString *value = [item objectForKey:@"value"];
-        if ([title isEqualToString:@"Sub-Total"] || [title isEqualToString:@"Total"]) {
-            if(appDelegate.can_see_price&&appDelegate.price_hidden==false)
-            {
-                
-            }
-            else
-            {
-                value=nil;
-            }
-        }
-        cell.chargeLabel.text = [title stringByAppendingString:@":"];
-        cell.priceLabel.text = value;
-        
-        cell.backgroundColor = [UIColor whiteColor];
-        return cell;
-        
-    }
-    
-    
-#endif
-    
-    
-#ifdef BUILD_HMLG
-    
-    switch(indexPath.section)
-    {
-        case 0:
-        {
-            
-            if(indexPath.row==0)
+            if(indexPath.row==0)
             {
                 NSString *CellIdentifier = @"OrderDetailHtmlCell";
                 OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
@@ -3730,11 +3147,7 @@
                     cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
 #endif
                     
-#ifdef BUILD_HOMER
-                    cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
-                    cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
-#endif
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
                     cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
 #endif
@@ -3751,14 +3164,11 @@
                     cell.chargeLabel.text = @"Handling Fee:";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
 #endif
-#ifdef BUILD_HOMER
-                    cell.chargeLabel.text = @"Handling Fee:";
-                    cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
-#endif
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
                     cell.chargeLabel.text = @"Handling Fee:";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
 #endif
+
 #ifdef BUILD_HMLG
                     NSString* price=[self.content_data valueForKey:@"Total"];
                     if(appDelegate.can_see_price&&appDelegate.price_hidden==false)

+ 61 - 2
RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m

@@ -279,9 +279,46 @@ static const int totalPage = 3;
     self.pageControlToolBar.items = items;
 }
 
+- (NSString *)getValue:(NSString *)key from:(NSArray *)control {
+    NSString *ret = nil;
+    for(int i = 0; i < control.count; i++)
+    {
+        NSMutableArray* items=(NSMutableArray*)control[i];
+        for(int j=0;j<items.count;j++)
+        {
+            NSDictionary* item=items[j];
+            NSString* item_name=[item valueForKey:@"name"];
+            if([item_name isEqualToString:key])
+            {
+                NSString* control = [item valueForKey:@"control"];
+                
+                if([control isEqualToString:@"enum"])
+                {
+                    NSDictionary* cadedate = [item objectForKey:@"cadedate"];
+                    int cc = [[cadedate valueForKey:@"count"] intValue];
+                    for(int l=0;l<cc;l++)
+                    {
+                        NSDictionary* val_json=[cadedate objectForKey:[NSString stringWithFormat:@"val_%d",l]];
+                        if([[val_json valueForKey:@"check"]intValue]==1)
+                            return [val_json valueForKey:@"value_id"];
+                    }
+                    
+                }
+                else
+                    
+                    return [item valueForKey:@"value"];
+            }
+        }
+    }
+    return ret;
+}
+
 #pragma mark - BarItem Action
 
 - (IBAction)frontBarItemClick:(UIBarButtonItem *)sender {
+    if (self.pageIndex == 0) {
+        return;
+    }
     self.pageIndex--;
     
     // 1.恢复当前页面数据
@@ -312,9 +349,11 @@ static const int totalPage = 3;
 }
 
 - (IBAction)nextBarItemClick:(UIBarButtonItem *)sender {
+    if (self.pageIndex == totalPage) {
+        return;
+    }
     
-    
-    NSMutableDictionary* upparams = [self check_cancommit:false]; // 当前页上行参数
+    NSMutableDictionary* upparams = [self check_cancommit:true]; // 当前页上行参数
     if(self.cancommit==false)
         return;
 
@@ -404,6 +443,26 @@ static const int totalPage = 3;
     
 }
 
+-(NSString*) getValue:(NSString*)name
+{
+    
+    if (self.pageContentControlArray.count) {
+        NSString* ret=nil;
+        for (NSInteger i = self.pageContentControlArray.count - 1; i >= 0 ; i--) {
+            NSArray *control = [self.pageContentControlArray objectAtIndex:i];
+            ret = [self getValue:name from:control];
+            if (ret != nil) {
+                return ret;
+            }
+        }
+        return ret;
+    } else {
+        return [self getValue:name from:self.content_data_control];
+    }
+    
+    
+}
+
 #pragma mark - Place Order
 
 - (void)alertMessage:(NSString *)msg {

+ 2 - 2
RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m

@@ -1658,7 +1658,7 @@
     UIAlertView * alert = nil;
     if(appDelegate.order_status==0)
     {
-        alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Choose your action", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to cart", nil),@"Switch to order history",NSLocalizedString(@"Close and cancel order", nil), nil];
+        alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Choose your action", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:@"Continue edit order",NSLocalizedString(@"Switch to cart", nil),@"Switch to order history",NSLocalizedString(@"Close and release order", nil), nil];
         
     }
     else
@@ -2645,7 +2645,7 @@
         else if(buttonIndex==3)
         {
             
-            [self.navigationController popToRootViewControllerAnimated:true];
+            [self.navigationController popToRootViewControllerAnimated:false];
             
             
             AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];

+ 1 - 7
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -41,13 +41,7 @@
     self.requestLoginBtn.hidden = YES;
 #endif
     
-#ifdef BUILD_HOMER
-    self.title=COMPANY_SHORT_NAME;
-    self.checkOfflineMode.hidden = YES;
-    self.requestLoginBtn.hidden = YES;
-#endif
-    
-#ifdef BUILD_GATIT
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     self.title=COMPANY_SHORT_NAME;
     self.checkOfflineMode.hidden = YES;
     self.requestLoginBtn.hidden = YES;

+ 2 - 2
RedAnt ERP Mobile/iSales-HOMER/AppDelegate.m

@@ -3080,9 +3080,9 @@ void UncaughtExceptionHandler(NSException *exception) {
     }
 #endif
     
-#ifdef BUILD_HOMER
+#if defined(BUILD_HOMER) || defined(BUILD_GATIT)
     
-    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,soid];//[arr_subject componentsJoinedByString:@" : "];
+    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,soid,COMPANY_NAME];//[arr_subject componentsJoinedByString:@" : "];
     
     if (self.user_type == USER_ROLE_CUSTOMER && ![Singleton sharedInstance].currentOrderIsMerged) {
         NSString *companyName = [self.customerInfo objectForKey:@"customer_name"];