Преглед изворни кода

1.修改GATIT,屏蔽NPD。

Pen Li пре 8 година
родитељ
комит
ca39867313

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 55 - 0
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -1772,6 +1772,31 @@
     
 # 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"];
@@ -1838,6 +1863,14 @@
      */
 #endif
     
+#ifdef BUILD_GATIT
+    
+    [map setValue:@"GATIT Website" forKey:@"title"];
+    [map setValue:@"rect_change_password" forKey:@"img"];
+    [self.sideMenuItems addObject:map.copy];
+    
+# endif
+    
 
     
     [self.sideMenuTable reloadData];
@@ -2142,6 +2175,11 @@
         
 #endif
         
+#ifdef BUILD_GATIT
+        NSString* title = @"GATIT BLOG";
+        
+#endif
+        
 #ifdef BUILD_NPD
         NSString* title = @"NPD BLOG";
         
@@ -2215,6 +2253,23 @@
         
         
         
+        [self.navigationController pushViewController:ViewController animated:YES];
+        
+    }
+    else if([title isEqualToString:@"GATIT Website"])
+    {
+        
+        NSString* url = @"https://homelegance.com/";
+        
+        NSString* title = @"GATIT";
+        
+        
+        WebViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WebViewController"];
+        ViewController.url = url;
+        ViewController.title = title;
+        
+        
+        
         [self.navigationController pushViewController:ViewController animated:YES];
         
     }

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

@@ -2348,6 +2348,11 @@
             [arr addObject:notifyMeAction];
         }
 #endif
+#ifdef BUILD_GATIT
+        if (!appDelegate.offline_mode && outOfStock) {
+            [arr addObject:notifyMeAction];
+        }
+#endif
         
         if(product_id.length>0)
             [arr addObject:noteRowAction];

+ 27 - 0
RedAnt ERP Mobile/common/Functions/category/CategorySearchFilterViewController.m

@@ -577,6 +577,33 @@
     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
+    
     
     
 }

+ 16 - 0
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -233,6 +233,19 @@
         }
         
         
+        self.cagegoryLabel.text =self.categoryString;
+        
+        self.categoryid = ids;
+#endif
+#ifdef BUILD_GATIT
+        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;
@@ -2184,6 +2197,9 @@
 #ifndef BUILD_HOMER
         item_category_id = self.categoryid;
 #endif
+#ifndef BUILD_GATIT
+        item_category_id = self.categoryid;
+#endif
         
         [self showDetailat:detail_id category_id:item_category_id name:[item valueForKey:@"name"] index:indexPath.row];
        

+ 141 - 0
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -1311,6 +1311,147 @@ 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 = [iSalesNetwork 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
+                if (appDelegate.offline_mode) {
+                    cell.btnNotifyMe.hidden = YES;
+                }
+                
+            }
+#endif
+            
+            
 #ifdef BUILD_HMLG
             cell.btnaddPortfolio.hidden = NO;
             cell.btnNotifyMe.hidden = YES;

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

@@ -4159,6 +4159,11 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
             cuft=ucbf*count;
             weight= uweight*count;
 #endif
+            
+#ifdef BUILD_GATIT
+            cuft=ucbf*count;
+            weight= uweight*count;
+#endif
         }
         
         

+ 593 - 33
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -380,9 +380,10 @@
         //                            [send_to addObject:customer_email];
     }
     ViewController.mail_to = send_to;
+    NSString* subject = nil;
     
 #ifdef BUILD_NPD
-    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from NEW PACIFIC DIRECT,INC.",company,so];
+    subject=[NSString stringWithFormat:@"%@ -- SO# %@ from NEW PACIFIC DIRECT,INC.",company,so];
     
     if (appDelegate.user_type == USER_ROLE_CUSTOMER&&self.is_shoporder) {
         NSString *companyName = [appDelegate.customerInfo objectForKey:@"customer_name"];
@@ -391,7 +392,16 @@
 #endif
     
 #ifdef BUILD_HOMER
-    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,so];
+    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_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"];
@@ -401,7 +411,7 @@
     
 #ifdef BUILD_HMLG
     
-    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from Homelegance.",company,so];
+    subject=[NSString stringWithFormat:@"%@ -- SO# %@ from Homelegance.",company,so];
     
 #endif
     
@@ -692,6 +702,20 @@
                             }
 #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
                         
                             [self.content_data setValue:img_url_down forKey:@"sign_url"];
@@ -859,6 +883,19 @@
                                     }
                                 }
 #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
                                 [self.content_data setValue:img_url_down forKey:@"sign_url"];
@@ -1319,6 +1356,51 @@
     
 #endif
     
+#ifdef 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"];
+    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_HMLG
     switch (indexPath.section) {
         case 0:
@@ -1522,6 +1604,50 @@
     
 #endif
     
+#ifdef BUILD_GATIT
+    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_HMLG
     switch (section) {
         case 0:
@@ -1672,6 +1798,35 @@
     
 #endif
     
+#ifdef 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"];
+    
+    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_HMLG
     
     switch (sender.tag) {
@@ -1731,6 +1886,10 @@
     return [[self.content_data objectForKey:@"count"] integerValue];
 #endif
     
+#ifdef BUILD_GATIT
+    return [[self.content_data objectForKey:@"count"] integerValue];
+#endif
+    
 #ifdef BUILD_HMLG
     return 4;
 #endif
@@ -1813,6 +1972,42 @@
     
 #endif
     
+#ifdef BUILD_GATIT
+    
+    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_HMLG
     
     // NSDictionary * item_json = [self.content_data objectForKey:@"items"];
@@ -1844,6 +2039,10 @@
         return 6;
 #endif
         
+#ifdef BUILD_GATIT
+        return 6;
+#endif
+        
 #ifdef BUILD_HMLG
         return 4;
 #endif
@@ -2565,38 +2764,391 @@
     
 #endif
     
-#ifdef BUILD_HMLG
+#ifdef BUILD_GATIT
+    /**
+     * ver1.90
+     */
+    NSDictionary *section = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
+    NSString *type = [section objectForKey:@"type"];
     
-    switch(indexPath.section)
-    {
-        case 0:
-        {
+    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(indexPath.row==0)
-            {
-                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:[self.content_data valueForKey:@"order_info"] baseURL:nil];
-                
-                cell.backgroundColor = [UIColor whiteColor];
-                return cell;
-            }
-            else
+            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) {
+            
+            if(appDelegate.offline_mode==false||offline_edit) {
+                cell.sign_img.userInteractionEnabled = YES;
+            }
+            
+        }
+        else if(status_code==0) {
+            if(appDelegate.offline_mode==false||offline_edit) {
+                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;
+            
+            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;
+                }
+            }
+            
+            if (![cell.imageName isEqualToString:img_url]) {
+                cell.imageName = img_url;
+                [cell.imgbtn setBackgroundImage:[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];
+                }
+                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];
+                            }
+                            else
+                                [cell.imgbtn setBackgroundImage:[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)
+            {
+                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:[self.content_data valueForKey:@"order_info"] baseURL:nil];
+                
+                cell.backgroundColor = [UIColor whiteColor];
+                return cell;
+            }
+            else
             {
                 
                 NSString *CellIdentifier = @"OrderDetailSignatureCell";
@@ -2946,6 +3498,10 @@
                     cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
 #endif
+#ifdef BUILD_GATIT
+                    cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
+                    cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
+#endif
                     
 #ifdef BUILD_HMLG
                     cell.chargeLabel.text = @"Tax:";
@@ -2963,6 +3519,10 @@
                     cell.chargeLabel.text = @"Handling Fee:";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
 #endif
+#ifdef 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)

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

@@ -47,6 +47,12 @@
     self.requestLoginBtn.hidden = YES;
 #endif
     
+#ifdef BUILD_GATIT
+    self.title=COMPANY_SHORT_NAME;
+    self.checkOfflineMode.hidden = NO;
+    self.requestLoginBtn.hidden = YES;
+#endif
+    
 #ifdef BUILD_NPD
     self.title=COMPANY_SHORT_NAME;
     self.checkOfflineMode.hidden=false;

+ 6 - 30
RedAnt ERP Mobile/iSales-GATIT.xcodeproj/xcuserdata/macmini1.xcuserdatad/xcschemes/GATIT Mobile.xcscheme

@@ -15,23 +15,9 @@
             <BuildableReference
                BuildableIdentifier = "primary"
                BlueprintIdentifier = "713F76A51929F4A7006A7305"
-               BuildableName = "NPD Mobile.app"
-               BlueprintName = "iSales-NPD"
-               ReferencedContainer = "container:iSales-NPD.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "YES"
-            buildForArchiving = "YES"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "713F76A51929F4A7006A7305"
-               BuildableName = "HOMER Mobile.app"
-               BlueprintName = "iSales-HOMER"
-               ReferencedContainer = "container:iSales-HOMER.xcodeproj">
+               BuildableName = "GATIT Mobile.app"
+               BlueprintName = "iSales-GATIT"
+               ReferencedContainer = "container:iSales-GATIT.xcodeproj">
             </BuildableReference>
          </BuildActionEntry>
       </BuildActionEntries>
@@ -70,9 +56,9 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "713F76A51929F4A7006A7305"
-            BuildableName = "HOMER Mobile.app"
-            BlueprintName = "iSales-HOMER"
-            ReferencedContainer = "container:iSales-HOMER.xcodeproj">
+            BuildableName = "GATIT Mobile.app"
+            BlueprintName = "iSales-GATIT"
+            ReferencedContainer = "container:iSales-GATIT.xcodeproj">
          </BuildableReference>
       </BuildableProductRunnable>
       <EnvironmentVariables>
@@ -91,16 +77,6 @@
       savedToolIdentifier = ""
       useCustomWorkingDirectory = "NO"
       debugDocumentVersioning = "YES">
-      <BuildableProductRunnable
-         runnableDebuggingMode = "0">
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "713F76A51929F4A7006A7305"
-            BuildableName = "HOMER Mobile.app"
-            BlueprintName = "iSales-HOMER"
-            ReferencedContainer = "container:iSales-HOMER.xcodeproj">
-         </BuildableReference>
-      </BuildableProductRunnable>
    </ProfileAction>
    <AnalyzeAction
       buildConfiguration = "Debug">

+ 3 - 1
RedAnt ERP Mobile/iSales-GATIT/config.h

@@ -8,12 +8,14 @@
 
 #ifndef RedAnt_ERP_Mobile_config_h
 #define RedAnt_ERP_Mobile_config_h
-#define BUILD_HOMER
+#define BUILD_GATIT
 
 #define  APP_NAME @"GATIT Mobile"
 #define  COMPANY_SHORT_NAME @"GATIT"
 #define  COMPANY_NAME @"HOMELEGANCE BY TITAN IMPORTER CO."
 #define  COMPANY_INFO @"Sales: titan@homelegance.com\nPhone: 888 349 9980"
+#define  COMPANY_WEB @"homelegance.com"
+#define  COMPANY_FULL_NAME @"HOMELEGANCE BY TITAN IMPORTER CO."
 
 # ifdef DEBUG
 #define test_server

+ 3 - 3
RedAnt ERP Mobile/iSales-GATIT/default_appearance.json

@@ -95,8 +95,8 @@
                 "note": "图片按钮文字颜色",
                 "control": "DefaultImageButton",
                 "function": "setTitleColor.Normal",
-                "value": "0x007aff",
-                "info": "blueColor"
+                "value": "#clearColor",
+                "info": "clearColor"
             }
             
             
@@ -188,4 +188,4 @@
         }
     },
     "name": "HMLG DEFAULT"
-}
+}

+ 0 - 14
RedAnt ERP Mobile/iSales-HOMER.xcodeproj/xcuserdata/macmini1.xcuserdatad/xcschemes/HOMER Mobile.xcscheme

@@ -6,20 +6,6 @@
       parallelizeBuildables = "YES"
       buildImplicitDependencies = "YES">
       <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "YES"
-            buildForArchiving = "YES"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "713F76A51929F4A7006A7305"
-               BuildableName = "NPD Mobile.app"
-               BlueprintName = "iSales-NPD"
-               ReferencedContainer = "container:iSales-NPD.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
          <BuildActionEntry
             buildForTesting = "YES"
             buildForRunning = "YES"