Просмотр исходного кода

修改Create TearSheet的Regular Price。

Pen Li 9 лет назад
Родитель
Сommit
3420b43932

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


+ 45 - 7
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -10311,17 +10311,55 @@
 
 
 + (NSData *)offline_createTearSheet:(NSMutableDictionary *)params {
 + (NSData *)offline_createTearSheet:(NSMutableDictionary *)params {
     
     
+    NSMutableDictionary *dic = [self dictionaryFileName:@"TearSheet.json"];
+    
+    [dic setObject:[params objectForKey:@"product_ids"] forKey:@"product_ids"];
+    [dic setObject:[params objectForKey:@"item_ids"] forKey:@"item_ids"];
     
     
+    NSMutableDictionary *section1 = [[dic objectForKey:@"section_1"] mutableCopy];
+    NSMutableDictionary *price = [[section1 objectForKey:@"item_2"] mutableCopy];
+    __block NSMutableDictionary *cadedate = [NSMutableDictionary dictionary];
 //    {
 //    {
-//        "item_ids" = "249,3859,5360,2662";
-//        password = 123456;
-//        "product_ids" = "3321,3804,4045,3732";
-//        user = EvanK;
+//        "count": 6,
+//        "val_1": {
+//            "value": "West Wholesale Price",
+//            "value_id": 17
+//        },
+//        
 //    }
 //    }
+    __block long val_count = 0;
+    NSString *sql = @"select name,type,order_by from price";
+    [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
+        
+        NSString *name = [self textAtColumn:0 statement:stmt];
+        int type = sqlite3_column_int(stmt, 1);
+        int order_by = sqlite3_column_int(stmt, 2);
+        
+//        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+        
+        NSDictionary *price_dic = @{
+                                    @"value" : name,
+                                    @"value_id" : name,
+                                    @"check" : order_by == 0 ? @(1) : @(0)
+                                    };
+        
+        [cadedate setObject:price_dic forKey:[NSString stringWithFormat:@"val_%d",order_by]];
+        
+        val_count = ++(*count);
+        
+    } failure:^(NSMutableDictionary *container, NSString *err_msg) {
+        val_count = 0;
+    }];
     
     
-    NSMutableDictionary *dic = [self dictionaryFileName:@"TearSheet.json"];
-    [dic setObject:[params objectForKey:@"product_ids"] forKey:@"product_ids"];
-    [dic setObject:[params objectForKey:@"item_ids"] forKey:@"item_ids"];
+    [cadedate setObject:@{@"value" : @"None",
+                          @"value_id" : @"None"} forKey:[NSString stringWithFormat:@"val_%ld",val_count]];
+    val_count++;
+    
+    [cadedate setObject:[NSNumber numberWithInteger:val_count] forKey:@"count"];
+    
+    [price setObject:cadedate forKey:@"cadedate"];
+    [section1 setObject:price forKey:@"item_2"];
+    [dic setObject:section1 forKey:@"section_1"];
     
     
     return [RAUtils dict2data:dic];
     return [RAUtils dict2data:dic];
 }
 }

+ 2 - 29
RedAnt ERP Mobile/iSales-NPD/TearSheet.json

@@ -110,34 +110,7 @@
 		"item_2": {
 		"item_2": {
 			"control": "enum",
 			"control": "enum",
 			"name": "regular_price",
 			"name": "regular_price",
-			"cadedate": {
-				"count": 6,
-				"val_1": {
-					"value": "West Wholesale Price",
-					"value_id": 17
-				},
-				"val_0": {
-					"check": 1,
-					"value": "West Dealer Price",
-					"value_id": 16
-				},
-				"val_3": {
-					"value": "East Wholesale Price",
-					"value_id": 15
-				},
-				"val_2": {
-					"value": "East Dealer Price",
-					"value_id": 14
-				},
-				"val_5": {
-					"value": "None",
-					"value_id": 0
-				},
-				"val_4": {
-					"value": "Container",
-					"value_id": 13
-				}
-			},
+			"cadedate": "",
 			"single_select": "true",
 			"single_select": "true",
 			"aname": "Regular Price"
 			"aname": "Regular Price"
 		},
 		},
@@ -212,4 +185,4 @@
 	"title": "Portfolio Product Information",
 	"title": "Portfolio Product Information",
 	"pdf_url": "",
 	"pdf_url": "",
 	"mode": "Regular Mode"
 	"mode": "Regular Mode"
-}
+}