|
|
@@ -10311,17 +10311,55 @@
|
|
|
|
|
|
+ (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];
|
|
|
}
|