Эх сурвалжийг харах

1.修改Homer,区分NPD。

Pen Li 8 жил өмнө
parent
commit
bcddb6dc80
28 өөрчлөгдсөн 896 нэмэгдсэн , 87 устгасан
  1. 3 1
      RedAnt ERP Mobile/HMLG Mobile/config.h
  2. BIN
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate
  3. 0 12
      RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  4. 14 10
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  5. 7 7
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  6. 26 1
      RedAnt ERP Mobile/common/Functions/category/CategorySearchFilterViewController.m
  7. 16 0
      RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m
  8. 9 7
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m
  9. 142 1
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m
  10. 12 6
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m
  11. 605 21
      RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m
  12. 3 3
      RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m
  13. 3 3
      RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m
  14. 3 0
      RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m
  15. 16 0
      RedAnt ERP Mobile/iSales-HOMER.xcodeproj/project.pbxproj
  16. 20 2
      RedAnt ERP Mobile/iSales-HOMER/AppDelegate.m
  17. 2 0
      RedAnt ERP Mobile/iSales-HOMER/config.h
  18. 1 1
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_logo.imageset/Contents.json
  19. BIN
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_logo.imageset/cover_logo.png
  20. 1 1
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_title.imageset/Contents.json
  21. BIN
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_title.imageset/portfolio_cover_title.png
  22. 1 1
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_logo_s.imageset/Contents.json
  23. BIN
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_logo_s.imageset/logo_s.png
  24. 1 1
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/salesorder_logo.imageset/Contents.json
  25. BIN
      RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/salesorder_logo.imageset/sales_order_logo.png
  26. 7 7
      RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard
  27. 1 1
      RedAnt ERP Mobile/iSales-NPD/TearSheet.json
  28. 3 1
      RedAnt ERP Mobile/iSales-NPD/config.h

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

@@ -12,8 +12,10 @@
 
 #define  APP_NAME @"HMLG Mobile"
 #define  COMPANY_NAME @"Homelegance"
-#define COMPANY_SHORT_NAME "Homelegance"
+#define COMPANY_SHORT_NAME @"Homelegance"
 #define  COMPANY_INFO @"Sales: sales@Homelegance.com\nPhone: 510.123.1234"
+#define  COMPANY_WEB @"homelegance.com"
+#define  COMPANY_FULL_NAME @"HOMELEGANCE LA, INC."
 
 #define CONTACT_LIST 1
 

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


+ 0 - 12
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,16 +2,4 @@
 <Bucket
    type = "0"
    version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            scope = "0"
-            stopOnStyle = "0">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
 </Bucket>

+ 14 - 10
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -464,15 +464,15 @@
     NSString* build =[infoDict objectForKey:@"CFBundleVersion"];
     NSString* version =[infoDict objectForKey:@"CFBundleShortVersionString"];
 
-#ifdef BUILD_HMLG
-    NSString* versionNum = [NSString stringWithFormat:@"HMLG %@ Build %@",version,build];
-#endif
-#ifdef BUILD_NPD
-    NSString* versionNum = [NSString stringWithFormat:@"npd %@ Build %@",version,build];
-#endif
-#ifdef BUILD_HOMER
-    NSString* versionNum = [NSString stringWithFormat:@"HOMER %@ Build %@",version,build];
-#endif
+//#ifdef BUILD_HMLG
+//    NSString* versionNum = [NSString stringWithFormat:@"HMLG %@ Build %@",version,build];
+//#endif
+//#ifdef BUILD_NPD
+//    NSString* versionNum = [NSString stringWithFormat:@"npd %@ Build %@",version,build];
+//#endif
+//#ifdef BUILD_HOMER
+    NSString* versionNum = [NSString stringWithFormat:@"%@ %@ Build %@",COMPANY_SHORT_NAME,version,build];
+//#endif
     
     [self initMenuItems];
     self.homeViewController =[ self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"];
@@ -1814,17 +1814,20 @@
     [map setValue:@"Simplified Buying Program" forKey:@"title"];
     [map setValue:@"rect_change_password" forKey:@"img"];
     [self.sideMenuItems addObject:map.copy];
- #endif   
+#endif
     
 #ifdef BUILD_HOMER
+    /*
     [map setValue:@"BLOG" forKey:@"title"];
     [map setValue:@"rect_change_password" forKey:@"img"];
     [self.sideMenuItems addObject:map.copy];
+     */
     
     [map setValue:@"HOMER Website" forKey:@"title"];
     [map setValue:@"rect_change_password" forKey:@"img"];
     [self.sideMenuItems addObject:map.copy];
     
+    /*
     [map setValue:@"HOMER Policy" forKey:@"title"];
     [map setValue:@"rect_change_password" forKey:@"img"];
     [self.sideMenuItems addObject:map.copy];
@@ -1832,6 +1835,7 @@
     [map setValue:@"Simplified Buying Program" forKey:@"title"];
     [map setValue:@"rect_change_password" forKey:@"img"];
     [self.sideMenuItems addObject:map.copy];
+     */
 #endif
     
 

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

@@ -2343,6 +2343,11 @@
             [arr addObject:notifyMeAction];
         }
 #endif
+#ifdef BUILD_HOMER
+        if (!appDelegate.offline_mode && outOfStock) {
+            [arr addObject:notifyMeAction];
+        }
+#endif
         
         if(product_id.length>0)
             [arr addObject:noteRowAction];
@@ -2881,14 +2886,9 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     }
     ViewController.mail_to = send_to;
     
-#ifdef BUILD_HOMER
-    ViewController.filename = [NSString stringWithFormat:@"HOMER_Product_List.pdf"];
-#endif
+    ViewController.filename = [NSString stringWithFormat:@"%@_Product_List.pdf",COMPANY_SHORT_NAME];
+
 
-#ifdef BUILD_NPD
-    ViewController.filename = [NSString stringWithFormat:@"NPD_Product_List.pdf"];
-#endif
-    
     ViewController.mail_subject = subject;
     
     ViewController.hidenavi = false;

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

@@ -550,7 +550,32 @@
     DebugLog(@"menu select %@",data);
 #endif
     
-    
+#ifdef BUILD_HOMER
+    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

@@ -220,6 +220,19 @@
 //        }];
 //        
         
+        self.cagegoryLabel.text =self.categoryString;
+        
+        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;
@@ -2168,6 +2181,9 @@
 #ifndef BUILD_NPD
         item_category_id = self.categoryid;
 #endif
+#ifndef BUILD_HOMER
+        item_category_id = self.categoryid;
+#endif
         
         [self showDetailat:detail_id category_id:item_category_id name:[item valueForKey:@"name"] index:indexPath.row];
        

+ 9 - 7
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -409,7 +409,8 @@
                     if(!appDelegate.can_create_backorder && c<count)
                     {
                         
-                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:NSLocalizedString(@"Item is OUT OF STOCK and not available to order from NPD.\nAdd to cart anyway?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"No", nil) otherButtonTitles:NSLocalizedString(@"Yes", nil), nil];
+                        NSString *msg = [NSString stringWithFormat:@"Item is OUT OF STOCK and not available to order from %@.\nAdd to cart anyway?",COMPANY_SHORT_NAME];
+                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:NSLocalizedString(msg, nil) delegate:self cancelButtonTitle:NSLocalizedString(@"No", nil) otherButtonTitles:NSLocalizedString(@"Yes", nil), nil];
                         
                         // alert.
                         
@@ -559,15 +560,15 @@
         
         NSString *msg = nil;
         BOOL continueAdd = YES;
-#ifdef BUILD_NPD
+// #ifdef BUILD_NPD
         AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
             
             if ([Singleton sharedInstance].currentOrderIsMerged) { // Purchase Order不允许购买数量大于库存
-                msg = @"Item is OUT OF STOCK and not available to order from NPD.";
+                msg = [NSString stringWithFormat:@"Item is OUT OF STOCK and not available to order from %@.",COMPANY_SHORT_NAME];
                 continueAdd = NO;
             } else { // Shop Order购买数量大于库存需要确认
-                msg = @"Item is OUT OF STOCK and not available to order from NPD.\nAdd to cart anyway?";
+                msg = [NSString stringWithFormat:@"Item is OUT OF STOCK and not available to order from %@.\nAdd to cart anyway?",COMPANY_SHORT_NAME];
                 continueAdd = YES;
             }
         }
@@ -576,7 +577,8 @@
             msg = @"Item is OUT OF STOCK and not available to order.";
             continueAdd = NO;
         }
- #endif
+
+// #endif
         
         
         UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:msg preferredStyle:UIAlertControllerStyleAlert];
@@ -1542,7 +1544,7 @@
 /**检查是否缺货*/
 - (void)checkAvailability:(int)availability buyQTY:(int)buyQty cartQTY:(int)cartQty { // availability不可以通过textField.text取得
     
-#ifdef BUILD_NPD
+//#ifdef BUILD_NPD
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     if (!appDelegate.bLogin || appDelegate.offline_mode || buyQty < 1) {
@@ -1604,7 +1606,7 @@
         }
         
     }
-#endif
+//#endif
     
 }
 

+ 142 - 1
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -1170,7 +1170,148 @@ self.isrefreshing=false;
                 }
                 
             }
-#else
+#endif
+#ifdef BUILD_HOMER
+            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;
 #endif

+ 12 - 6
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -134,12 +134,14 @@
     NSMutableDictionary* values=params[@"replaceValue"]; // 离线下发的参数
     //生成portfolio pdf需要的数据
     NSMutableDictionary* data = [[NSMutableDictionary alloc]init];
-    data[@"npd_url"]=@"www.newpacificdirect.com";
+
+    data[@"npd_url"]=COMPANY_WEB;
+
     NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
     [formatter setDateFormat:@"MMMM yyyy"];
     NSString* date = [formatter stringFromDate:[NSDate date]];
     data[@"create_month"]=date;
-    data[@"company_name"]=@"New Pacific Direct,Inc.";
+    data[@"company_name"]=COMPANY_FULL_NAME;
     data[@"catalog_name"]=params[@"catalog_name"];
     data[@"PAGE_INDEX"]=@"Page $.{CURRENT_PAGE}.$ of $.{TOTAL_PAGE}.$";
     data[@"TOTAL_PAGE"]=0;
@@ -642,12 +644,12 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     
 
     NSMutableDictionary* data = [[NSMutableDictionary alloc]init];
-    data[@"npd_url"]=@"www.newpacificdirect.com";
+    data[@"npd_url"]=COMPANY_WEB;
     NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
     [formatter setDateFormat:@"MM/dd/yyyy HH:mm:ss"];
     NSString* date = [formatter stringFromDate:[NSDate date]];
     data[@"print_date"]=date;
-    data[@"company_name"]=@"New Pacific Direct,Inc.";
+    data[@"company_name"]=COMPANY_FULL_NAME;
     data[@"PAGE_INDEX"]=@"Page $.{CURRENT_PAGE}.$ of $.{TOTAL_PAGE}.$";
     data[@"TOTAL_PAGE"]=0;
     data[@"CURRENT_PAGE"]=0;
@@ -662,7 +664,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     bool bwrite=[UIImagePNGRepresentation(qrimg)writeToFile: qrpath    atomically:YES];
     data[@"img_barcode"]=qrpath;
     data[@"so_id"]=order_code;
-    data[@"company"]=@"NEW PACIFIC DIRECT, INC.";
+    data[@"company"]=COMPANY_FULL_NAME;
     
     
     
@@ -4153,6 +4155,10 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
             weight= uweight*count;
 #endif
             
+#ifdef BUILD_HOMER
+            cuft=ucbf*count;
+            weight= uweight*count;
+#endif
         }
         
         
@@ -11092,7 +11098,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
             
             NSMutableDictionary *resultDic = [NSMutableDictionary dictionary];
             
-            [resultDic setObject:@"some item(s) are out of stock,please remove them from cart before placing order with NPD or try again after sync" forKey:@"err_msg"];
+            [resultDic setObject:[NSString stringWithFormat:@"some item(s) are out of stock,please remove them from cart before placing order with %@ or try again after sync",COMPANY_SHORT_NAME] forKey:@"err_msg"];
             [resultDic setObject:[NSNumber numberWithInt:8] forKey:@"result"];
             
             return [RAUtils dict2data:resultDic];

+ 605 - 21
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -382,13 +382,24 @@
     ViewController.mail_to = send_to;
     
 #ifdef BUILD_NPD
-    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from NEW PACIFIC DIRECT,INC.",company,so];//[arr_subject componentsJoinedByString:@" : "];
+    NSString* 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"];
         subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,so,companyName];
     }
-#else
+#endif
+    
+#ifdef BUILD_HOMER
+    NSString* 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
     
     NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from Homelegance.",company,so];
     
@@ -665,7 +676,24 @@
                                     break;
                                 }
                             }
-#else
+#endif
+                            
+#ifdef BUILD_HOMER
+                            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"];
 #endif
                             //self.btnSign.enabled = false;
@@ -816,7 +844,23 @@
                                         break;
                                     }
                                 }
-#else
+#endif
+                                
+#ifdef BUILD_HOMER
+                                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"];
 #endif
                                 //self.btnSign.enabled = false;
@@ -1227,8 +1271,55 @@
     } else if ([type isEqualToString:@"price_info"]) {
         return 44;
     }
+    
+#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
+    } else if ([type isEqualToString:@"price_info"]) {
+        return 44;
+    }
+    
+#endif
+    
+#ifdef BUILD_HMLG
     switch (indexPath.section) {
         case 0:
         {
@@ -1385,7 +1476,53 @@
         [myView addSubview:btn];
     }
     
-#else
+#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_HMLG
     switch (section) {
         case 0:
             labeltitle= @"Order Info";
@@ -1504,7 +1641,38 @@
         [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
     }
     
-#else
+#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_HMLG
     
     switch (sender.tag) {
         case 0:{
@@ -1557,7 +1725,13 @@
         return 0;
 #ifdef BUILD_NPD
     return [[self.content_data objectForKey:@"count"] integerValue];
-#else
+#endif
+    
+#ifdef BUILD_HOMER
+    return [[self.content_data objectForKey:@"count"] integerValue];
+#endif
+    
+#ifdef BUILD_HMLG
     return 4;
 #endif
 }
@@ -1601,7 +1775,45 @@
     
     return 0;
     
-#else
+#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_HMLG
     
     // NSDictionary * item_json = [self.content_data objectForKey:@"items"];
     if(section==0)
@@ -1626,7 +1838,13 @@
     if(section==3) {
 #ifdef BUILD_NPD
         return 6;
-#else
+#endif
+        
+#ifdef BUILD_HOMER
+        return 6;
+#endif
+        
+#ifdef BUILD_HMLG
         return 4;
 #endif
     }
@@ -1993,17 +2211,371 @@
     }
     
     
-#else
+#endif
     
-    switch(indexPath.section)
-    {
-        case 0:
-        {
+#ifdef BUILD_HOMER
+    /**
+     * ver1.90
+     */
+    NSDictionary *section = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
+    NSString *type = [section objectForKey:@"type"];
+    
+    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];
+            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];
                 
                 
                 
@@ -2368,7 +2940,14 @@
 #ifdef BUILD_NPD
                     cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
-#else
+#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_HMLG
                     cell.chargeLabel.text = @"Tax:";
                     NSString *tax = [self.content_data valueForKey:@"Tax"] ? [self.content_data valueForKey:@"Tax"] : @"$0.00";
                     cell.priceLabel.text = tax;
@@ -2379,7 +2958,12 @@
 #ifdef BUILD_NPD
                     cell.chargeLabel.text = @"Handling Fee:";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
-#else
+#endif
+#ifdef BUILD_HOMER
+                    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)
                     {

+ 3 - 3
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -392,7 +392,7 @@
         } else {
             
             if (self.orderTypeSegmentControl.numberOfSegments == 1 && !self.table_order.isEditing) {
-                [self.orderTypeSegmentControl insertSegmentWithTitle:@"Purchase Order to NPD" atIndex:1 animated:YES];
+                [self.orderTypeSegmentControl insertSegmentWithTitle:[NSString stringWithFormat:@"Purchase Order to %@",COMPANY_SHORT_NAME] atIndex:1 animated:YES];
             }
             
         }
@@ -1950,7 +1950,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
         // 结束选择时恢复
         if ([Singleton sharedInstance].customer_can_see_sales_Order && ![Singleton sharedInstance].global_lock) { // 有查看Sales order 权限,并且app没有锁
             if (self.orderTypeSegmentControl.numberOfSegments == 1) {
-                [self.orderTypeSegmentControl insertSegmentWithTitle:@"Purchase Order to NPD" atIndex:1 animated:YES];
+                [self.orderTypeSegmentControl insertSegmentWithTitle:[NSString stringWithFormat:@"Purchase Order to %@",COMPANY_SHORT_NAME] atIndex:1 animated:YES];
             }
         }
         
@@ -2135,7 +2135,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     } else { // 解锁
         if ([Singleton sharedInstance].customer_can_see_sales_Order) { // 有查看Sales order 权限
             if (self.orderTypeSegmentControl.numberOfSegments == 1 && !self.table_order.isEditing) {
-                [self.orderTypeSegmentControl insertSegmentWithTitle:@"Purchase Order to NPD" atIndex:1 animated:YES];
+                [self.orderTypeSegmentControl insertSegmentWithTitle:[NSString stringWithFormat:@"Purchase Order to %@",COMPANY_SHORT_NAME] atIndex:1 animated:YES];
             }
         }
         

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

@@ -36,19 +36,19 @@
 {
     [super viewDidLoad];
 #ifdef BUILD_HMLG
-    self.title=@"HMLG";
+    self.title=COMPANY_SHORT_NAME;
     self.checkOfflineMode.hidden=true;
     self.requestLoginBtn.hidden = YES;
 #endif
     
 #ifdef BUILD_HOMER
-    self.title=@"HOMER";
+    self.title=COMPANY_SHORT_NAME;
     self.checkOfflineMode.hidden = NO;
     self.requestLoginBtn.hidden = YES;
 #endif
     
 #ifdef BUILD_NPD
-    self.title=@"NPD";
+    self.title=COMPANY_SHORT_NAME;
     self.checkOfflineMode.hidden=false;
 #endif
     self.showList = false;

+ 3 - 0
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -1320,6 +1320,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     ViewController.mail_to = send_to;
     
     //    ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Wish_List %@.pdf",cur_time];
+/*
 #ifdef BUILD_HOMER
     ViewController.filename = [NSString stringWithFormat:@"HOMER_Wish_List.pdf"];
 #endif
@@ -1327,6 +1328,8 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 #ifdef BUILD_NPD
     ViewController.filename = [NSString stringWithFormat:@"NPD_Wish_List.pdf"];
 #endif
+ */
+    ViewController.filename = [NSString stringWithFormat:@"%@_Wish_List.pdf",COMPANY_SHORT_NAME];
     ViewController.mail_subject = subject;
     
     ViewController.hidenavi = false;

+ 16 - 0
RedAnt ERP Mobile/iSales-HOMER.xcodeproj/project.pbxproj

@@ -24,6 +24,12 @@
 		428980721E24B1E9005F1BD8 /* Singleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 428980711E24B1E9005F1BD8 /* Singleton.m */; };
 		4289809E1E24B526005F1BD8 /* JKTimerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4289809D1E24B526005F1BD8 /* JKTimerManager.m */; };
 		42B309791E45BA32007AFC62 /* status_filter_cadedate_po.json in Resources */ = {isa = PBXBuildFile; fileRef = 42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */; };
+		42B9A2341F4692F000C808F3 /* placeOrderTemplate.json in Resources */ = {isa = PBXBuildFile; fileRef = 42B9A2331F4692F000C808F3 /* placeOrderTemplate.json */; };
+		42B9A2361F46933A00C808F3 /* TearSheet.json in Resources */ = {isa = PBXBuildFile; fileRef = 42B9A2351F46933A00C808F3 /* TearSheet.json */; };
+		42B9A2371F46B49B00C808F3 /* DejaVuSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 71C1D8321F456ABE00CEA1C9 /* DejaVuSans-Bold.ttf */; };
+		42B9A2381F46B49B00C808F3 /* DejaVuSans.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 71C1D8331F456ABE00CEA1C9 /* DejaVuSans.ttf */; };
+		42B9A2391F46B49B00C808F3 /* KALINGA.TTF in Resources */ = {isa = PBXBuildFile; fileRef = 71C1D8341F456ABE00CEA1C9 /* KALINGA.TTF */; };
+		42B9A23A1F46B49B00C808F3 /* KALINGAB.TTF in Resources */ = {isa = PBXBuildFile; fileRef = 71C1D8351F456ABE00CEA1C9 /* KALINGAB.TTF */; };
 		42BEF34F1E89FE1100632AB6 /* FirebaseAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF3241E89FE1100632AB6 /* FirebaseAnalytics.framework */; };
 		42BEF3501E89FE1100632AB6 /* FirebaseCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BEF3271E89FE1100632AB6 /* FirebaseCore.framework */; };
 		42BEF3511E89FE1200632AB6 /* CHANGELOG.md in Sources */ = {isa = PBXBuildFile; fileRef = 42BEF3291E89FE1100632AB6 /* CHANGELOG.md */; };
@@ -303,6 +309,8 @@
 		4289809C1E24B526005F1BD8 /* JKTimerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JKTimerManager.h; sourceTree = "<group>"; };
 		4289809D1E24B526005F1BD8 /* JKTimerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JKTimerManager.m; sourceTree = "<group>"; };
 		42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = status_filter_cadedate_po.json; path = common/Functions/order/status_filter_cadedate_po.json; sourceTree = SOURCE_ROOT; };
+		42B9A2331F4692F000C808F3 /* placeOrderTemplate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = placeOrderTemplate.json; path = "iSales-NPD/placeOrderTemplate.json"; sourceTree = SOURCE_ROOT; };
+		42B9A2351F46933A00C808F3 /* TearSheet.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = TearSheet.json; path = "iSales-NPD/TearSheet.json"; sourceTree = SOURCE_ROOT; };
 		42BEF3241E89FE1100632AB6 /* FirebaseAnalytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseAnalytics.framework; sourceTree = "<group>"; };
 		42BEF3271E89FE1100632AB6 /* FirebaseCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseCore.framework; sourceTree = "<group>"; };
 		42BEF3291E89FE1100632AB6 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
@@ -1405,6 +1413,8 @@
 				71C1D8361F456BE800CEA1C9 /* more_info.html */,
 				71C1D8371F456BE800CEA1C9 /* order_info.html */,
 				71C1D8381F456BE800CEA1C9 /* category.json */,
+				42B9A2351F46933A00C808F3 /* TearSheet.json */,
+				42B9A2331F4692F000C808F3 /* placeOrderTemplate.json */,
 				71C1D8391F456BE800CEA1C9 /* contactAdvanceSearch.json */,
 				71C1D83A1F456BE800CEA1C9 /* createContact.json */,
 				71C1D83B1F456BE800CEA1C9 /* editContact.json */,
@@ -1886,12 +1896,18 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				42B9A2371F46B49B00C808F3 /* DejaVuSans-Bold.ttf in Resources */,
+				42B9A2381F46B49B00C808F3 /* DejaVuSans.ttf in Resources */,
+				42B9A2391F46B49B00C808F3 /* KALINGA.TTF in Resources */,
+				42B9A23A1F46B49B00C808F3 /* KALINGAB.TTF in Resources */,
 				71C1D85E1F456FCF00CEA1C9 /* config.plist in Resources */,
 				71C1D83E1F456BE800CEA1C9 /* order_info.html in Resources */,
 				71E3634A1F46963200CFAF19 /* Main.storyboard in Resources */,
 				42BEF3591E89FE1200632AB6 /* LICENSE in Resources */,
+				42B9A2361F46933A00C808F3 /* TearSheet.json in Resources */,
 				71C1D8411F456BE800CEA1C9 /* createContact.json in Resources */,
 				7115D45D1E16317600EF4E4C /* CommonEditor.storyboard in Resources */,
+				42B9A2341F4692F000C808F3 /* placeOrderTemplate.json in Resources */,
 				713F76C21929F4A7006A7305 /* Images.xcassets in Resources */,
 				71BF33011EFA1D6100842CB4 /* Assets.bundle in Resources */,
 				71C1D8431F456BE800CEA1C9 /* orderDetail.json in Resources */,

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

@@ -487,14 +487,20 @@ void UncaughtExceptionHandler(NSException *exception) {
     NSString* build =[infoDict objectForKey:@"CFBundleVersion"];
     NSString* version =[infoDict objectForKey:@"CFBundleShortVersionString"];
     NSString *versionNum = @"";
+/*
 #ifdef BUILD_NPD
     versionNum = [NSString stringWithFormat:@"Version: npd %@ Build %@",version,build];
 #endif
     
+#ifdef BUILD_HOMER
+    versionNum = [NSString stringWithFormat:@"Version: HOMER %@ Build %@",version,build];
+#endif
+    
 #ifdef BUILD_HMLG
     versionNum = [NSString stringWithFormat:@"Version: HOMELEGANCE %@ Build %@",version,build];
 #endif
-    
+    */
+    versionNum = [NSString stringWithFormat:@"Version: %@ %@ Build %@",COMPANY_SHORT_NAME,version,build];
     versionNum = [versionNum stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
     /**
      *  获取异常崩溃信息
@@ -2967,7 +2973,19 @@ void UncaughtExceptionHandler(NSException *exception) {
         NSString *companyName = [self.customerInfo objectForKey:@"customer_name"];
         subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,soid,companyName];
     }
-#else
+#endif
+    
+#ifdef BUILD_HOMER
+    
+    NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,soid];//[arr_subject componentsJoinedByString:@" : "];
+    
+    if (self.user_type == USER_ROLE_CUSTOMER && ![Singleton sharedInstance].currentOrderIsMerged) {
+        NSString *companyName = [self.customerInfo objectForKey:@"customer_name"];
+        subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,soid,companyName];
+    }
+#endif
+    
+#ifdef BUILD_HMLG
     
     NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from Homelegance.",company,soid];
     

+ 2 - 0
RedAnt ERP Mobile/iSales-HOMER/config.h

@@ -14,6 +14,8 @@
 #define  COMPANY_SHORT_NAME @"HOMER"
 #define  COMPANY_NAME @"HOMELEGANCE LA, INC."
 #define  COMPANY_INFO @"Sales: homerica@homelegance.com\nPhone: 888/458-1688"
+#define  COMPANY_WEB @"homelegance.com"
+#define  COMPANY_FULL_NAME @"HOMELEGANCE LA, INC."
 
 # ifdef DEBUG
 #define test_server

+ 1 - 1
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_logo.imageset/Contents.json

@@ -2,7 +2,7 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "NPD logo.jpg",
+      "filename" : "cover_logo.png",
       "scale" : "1x"
     },
     {

BIN
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_logo.imageset/cover_logo.png


+ 1 - 1
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_title.imageset/Contents.json

@@ -2,7 +2,7 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "Logo NPD-5.png",
+      "filename" : "portfolio_cover_title.png",
       "scale" : "1x"
     },
     {

BIN
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_cover_title.imageset/portfolio_cover_title.png


+ 1 - 1
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_logo_s.imageset/Contents.json

@@ -2,7 +2,7 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "NPD logo(1).jpg",
+      "filename" : "logo_s.png",
       "scale" : "1x"
     },
     {

BIN
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/portfolio_logo_s.imageset/logo_s.png


+ 1 - 1
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/salesorder_logo.imageset/Contents.json

@@ -2,7 +2,7 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "npd(1).png",
+      "filename" : "sales_order_logo.png",
       "scale" : "1x"
     },
     {

BIN
RedAnt ERP Mobile/iSales-HOMER/pdfcreator.xcassets/salesorder_logo.imageset/sales_order_logo.png


+ 7 - 7
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" colorMatched="YES" initialViewController="jsC-F8-zYF">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16A323" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" colorMatched="YES" initialViewController="jsC-F8-zYF">
     <device id="ipad9_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
@@ -970,10 +970,10 @@
                                 <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
                                 <prototypes>
                                     <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="DetailHeaderCell" rowHeight="550" id="PCZ-Ci-oQf" customClass="DetailHeaderCell">
-                                        <rect key="frame" x="0.0" y="55.5" width="768" height="550"/>
+                                        <rect key="frame" x="0.0" y="56" width="768" height="550"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PCZ-Ci-oQf" id="DiR-eY-PiR">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="549.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="549"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="USD 123.45" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="fD8-Km-IT3">
@@ -1260,7 +1260,7 @@
                                         <rect key="frame" x="0.0" y="605.5" width="768" height="600"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="zzF-db-bsq" id="rZ0-x8-h3B">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="599.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="599"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Refreshing...
Please wait." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bSP-hh-M2A">
@@ -1331,7 +1331,7 @@
                                         </tableViewCellContentView>
                                     </tableViewCell>
                                     <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="DetailInfoCell" rowHeight="44" id="hYM-aE-rjR" customClass="DetailKVCell">
-                                        <rect key="frame" x="0.0" y="1805.5" width="768" height="44"/>
+                                        <rect key="frame" x="0.0" y="1806" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hYM-aE-rjR" id="o59-aa-UU2">
                                             <rect key="frame" x="0.0" y="0.0" width="768" height="43"/>
@@ -2200,7 +2200,7 @@
                                         <rect key="frame" x="0.0" y="88" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Pol-lE-P45" id="FAm-1c-nX0">
-                                            <rect key="frame" x="0.0" y="0.0" width="702" height="44"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="730" height="44"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Clean Cache" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AHm-p1-51h">
@@ -8032,7 +8032,7 @@ Email: redantsupport@united-us.net</string>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HwF-54-hzr">
-                                                    <rect key="frame" x="28" y="0.0" width="672" height="43.5"/>
+                                                    <rect key="frame" x="15" y="0.0" width="698" height="43.5"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="16"/>
                                                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

+ 1 - 1
RedAnt ERP Mobile/iSales-NPD/TearSheet.json

@@ -14,7 +14,7 @@
 			"control": "text",
 			"keyboard": "text",
 			"name": "company_name",
-			"value": "New Pacific Direct,Inc.",
+			"value": "HOMELEGANCE LA, INC.",
 			"aname": "Company Name"
 		},
 		"item_3": {

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

@@ -32,9 +32,11 @@
 #define CONTACT_LIST 1
 
 #define  APP_NAME @"NPD Mobile"
-#define COMPANY_SHORT_NAME "NPD"
+#define COMPANY_SHORT_NAME @"NPD"
 #define  COMPANY_NAME @"New Pacific Direct"
 #define  COMPANY_INFO @"Sales: sales@newpacificdirect.com\nPhone: 510.818.9388"
+#define  COMPANY_WEB @"www.newpacificdirect.com"
+#define  COMPANY_FULL_NAME @"New Pacific Direct,Inc."
 
 #define LOCAL_URL_CUSTOMER_INFO_EDITOR @"customer_info_template"
 #define LOCAL_URL_CUSTOMER_INFO_EDIT @"customer_info_template_edit"