Sfoglia il codice sorgente

增加category.json文件,实现offline_category :方法中查询,filter选择查询未完。。

Pen Li 9 anni fa
parent
commit
e5ce45bb10

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


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

@@ -2,4 +2,16 @@
 <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>

+ 328 - 489
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -954,108 +954,6 @@
     
     
     [iSalesDB close_db:db];
-    DebugLog(@"data string: %@",[RAUtils dict2string:ret] );
-    
-    return ret;
-}
-+(NSDictionary*) offline_category :(NSMutableDictionary *) params
-{
-    NSString* orderCode = [params valueForKey:@"orderCode"];
-    
-    NSString* category = [params valueForKey:@"category"];
-    
-    int limit = [[params valueForKey:@"limit"] intValue];
-    int offset = [[params valueForKey:@"offset"] intValue];
-    
-    NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
-    
-    
-    
-    
-    
-    
-    sqlite3 *db = [iSalesDB get_db];
-    
-    int count = [iSalesDB get_recordcount:db table:@"model" where:[NSString stringWithFormat:@"category like'%%#%@#%%'",category]];
-    
-    
-    NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where m.category like'%%#%@#%%' order by m.name limit %d offset %d ;",category,limit, offset];
-    
-    DebugLog(@"offline_category sql:%@",sqlQuery);
-    sqlite3_stmt * statement;
-    [ret setValue:@"2" forKey:@"result"];
-    [ret setValue:[NSString stringWithFormat:@"%d",count] forKey:@"item_total_count"];
-    NSMutableDictionary* items = [[NSMutableDictionary alloc] init];
-    //    int count=0;
-    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
-    {
-        
-        int i=0;
-        while (sqlite3_step(statement) == SQLITE_ROW)
-        {
-            NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
-            
-            //            char *name = (char*)sqlite3_column_text(statement, 1);
-            //            NSString *nsNameStr = [[NSString alloc]initWithUTF8String:name];
-            
-            char *name = (char*)sqlite3_column_text(statement, 0);
-            if(name==nil)
-                name="";
-            NSString *nsname = [[NSString alloc]initWithUTF8String:name];
-            
-            char *description = (char*)sqlite3_column_text(statement, 1);
-            if(description==nil)
-                description="";
-            NSString *nsdescription = [[NSString alloc]initWithUTF8String:description];
-            
-            
-            
-            int product_id = sqlite3_column_int(statement, 2);
-            
-            
-            //            char *url = (char*)sqlite3_column_text(statement, 3);
-            //            if(url==nil)
-            //                url="";
-            //            NSString *nsurl = [[NSString alloc]initWithUTF8String:url];
-            
-            int wid = sqlite3_column_int(statement, 3);
-            int closeout = sqlite3_column_int(statement, 4);
-            
-            NSMutableDictionary* imgjson=[self category_img:product_id];
-            
-            if(wid==0)
-                [item setValue:@"false" forKey:@"wish_exists"];
-            else
-                [item setValue:@"true" forKey:@"wish_exists"];
-            
-            if(closeout==0)
-                [item setValue:@"false" forKey:@"is_closeout"];
-            else
-                [item setValue:@"true" forKey:@"is_closeout"];
-            
-            [item addEntriesFromDictionary:imgjson];
-            
-            
-            // [item setValue:nsurl forKey:@"img"];
-            [item setValue:nsname forKey:@"name"];
-            [item setValue:nsdescription forKey:@"description"];
-            [item setValue:[NSString stringWithFormat:@"%d",product_id] forKey:@"product_id"];
-            [items setObject:item forKey:[NSString stringWithFormat:@"item_%d",i]];
-            i++;
-            
-        }
-        [items setValue:[NSString stringWithFormat:@"%d",i] forKey:@"count"];
-        [ret setObject:items forKey:@"items"];
-        sqlite3_finalize(statement);
-    }
-    NSLog(@"count:%d",count);
-    
-    
-    [iSalesDB close_db:db];
-    
-    
-    
-    
     DebugLog(@"data string: %@",[RAUtils dict2string:ret] );
     
     return ret;
@@ -2742,8 +2640,6 @@
 
 #pragma mark - Jack
 
-#pragma mark create new contact
-
 + (NSDictionary *)offline_getAllCountryDefault:(NSString *)countryCode {
     //    "val_227" : {
     //        "check" : 1,
@@ -2755,54 +2651,20 @@
         countryCode = @"US";
     }
     
-//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//    sqlite3 *db = [iSalesDB get_db];
-//    
-//    const char *sqlQuery = "select _id,name,code,countrycode_id from offline_country;";
-//    sqlite3_stmt * statement;
-//    
-//    if (sqlite3_prepare_v2(db, sqlQuery, -1, &statement, nil) == SQLITE_OK) {
-//        
-//        long count = 0;
-//        while (sqlite3_step(statement) == SQLITE_ROW) {
-//            char *name = (char *) sqlite3_column_text(statement, 1); // 全称
-//            char *code = (char *) sqlite3_column_text(statement, 2); // 缩写
-//            int code_id = sqlite3_column_int(statement, 3); // id
-//            
-//            NSMutableDictionary *countryDic = [NSMutableDictionary dictionaryWithCapacity:2];
-//            [countryDic setValue:[NSString stringWithFormat:@"%s",name] forKey:@"value"];
-//            [countryDic setValue:[NSString stringWithFormat:@"%d",code_id] forKey:@"value_id"];
-//            [countryDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
-//            
-//            if ([countryCode isEqualToString:[NSString stringWithUTF8String:code]]) {
-//                [countryDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
-//            }
-//            
-//            NSString *key = [NSString stringWithFormat:@"val_%ld",count++];
-//            [dic setValue:countryDic forKey:key];
-//        }
-//        
-//        sqlite3_finalize(statement);
-//    }
-//    
-//    [iSalesDB close_db:db];
-//    [dic setValue:[NSNumber numberWithInt:dic.allKeys.count] forKey:@"count"];
-//    return dic;
-
     NSMutableDictionary *ret = [[iSalesDB jk_query:@"select _id,name,code,countrycode_id from offline_country;" completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container,long *count) {
         char *name = (char *) sqlite3_column_text(stmt, 1); // 全称
         char *code = (char *) sqlite3_column_text(stmt, 2); // 缩写
         int code_id = sqlite3_column_int(stmt, 3); // id
-
+        
         NSMutableDictionary *countryDic = [NSMutableDictionary dictionaryWithCapacity:2];
         [countryDic setValue:[NSString stringWithFormat:@"%s",name] forKey:@"value"];
         [countryDic setValue:[NSString stringWithFormat:@"%d",code_id] forKey:@"value_id"];
         [countryDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
-
+        
         if ([countryCode isEqualToString:[NSString stringWithUTF8String:code]]) {
             [countryDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
         }
-    
+        
         long n = *count;
         *count = n + 1;
         NSString *key = [NSString stringWithFormat:@"val_%ld",n];
@@ -2815,61 +2677,24 @@
 
 + (NSDictionary *)offline_getStateByCountryCode:(NSString *)countryCode checkedState:(NSString *)state_code{
     
-//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//    
-//    sqlite3 *db = [iSalesDB get_db];
-//    
-//    NSString *sqlQuery = [NSString stringWithFormat:@"select _id,name,code,country_code from offline_state where country_code = '%@';",countryCode];
-//    
-//    //    NSString *sqlQuery = [NSString stringWithFormat:@"select * from offline_state"];
-//    DebugLog(@"query state:%@",sqlQuery);
-//    
-//    sqlite3_stmt * statement;
-//    
-//    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-//        int i = 0;
-//        while (sqlite3_step(statement) == SQLITE_ROW) {
-//            char *name = (char *) sqlite3_column_text(statement, 1); // value
-//            char *code = (char *) sqlite3_column_text(statement, 2); // value_id
-//            
-//            NSMutableDictionary *stateDic = [NSMutableDictionary dictionaryWithCapacity:2];
-//            [stateDic setValue:[NSString stringWithUTF8String:name] forKey:@"value"];
-//            [stateDic setValue:[NSString stringWithUTF8String:code] forKey:@"value_id"];
-//            [stateDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
-//            
-//            if (state_code && [[NSString stringWithUTF8String:code] isEqualToString:state_code]) {
-//                [stateDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
-//            }
-//            
-//            NSString *key = [NSString stringWithFormat:@"val_%d",i++];
-//            [dic setValue:stateDic forKey:key];
-//        }
-//        
-//        sqlite3_finalize(statement);
-//    }
-//    
-//    [iSalesDB close_db:db];
-//    [dic setValue:[NSNumber numberWithInt:dic.allKeys.count] forKey:@"count"];
-//    return dic;
-    
     NSString *sqlQuery = [NSString stringWithFormat:@"select _id,name,code,country_code from offline_state where country_code = '%@';",countryCode];
     
     NSMutableDictionary *ret = [[iSalesDB jk_query:sqlQuery completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
         
         char *name = (char *) sqlite3_column_text(stmt, 1); // value
-            char *code = (char *) sqlite3_column_text(stmt, 2); // value_id
-
-            NSMutableDictionary *stateDic = [NSMutableDictionary dictionaryWithCapacity:2];
-            [stateDic setValue:[NSString stringWithUTF8String:name] forKey:@"value"];
-            [stateDic setValue:[NSString stringWithUTF8String:code] forKey:@"value_id"];
-            [stateDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
-
-            if (state_code && [[NSString stringWithUTF8String:code] isEqualToString:state_code]) {
-                [stateDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
-            }
-
-            NSString *key = [NSString stringWithFormat:@"val_%ld",(*count)++];
-            [container setValue:stateDic forKey:key];
+        char *code = (char *) sqlite3_column_text(stmt, 2); // value_id
+        
+        NSMutableDictionary *stateDic = [NSMutableDictionary dictionaryWithCapacity:2];
+        [stateDic setValue:[NSString stringWithUTF8String:name] forKey:@"value"];
+        [stateDic setValue:[NSString stringWithUTF8String:code] forKey:@"value_id"];
+        [stateDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
+        
+        if (state_code && [[NSString stringWithUTF8String:code] isEqualToString:state_code]) {
+            [stateDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
+        }
+        
+        NSString *key = [NSString stringWithFormat:@"val_%ld",(*count)++];
+        [container setValue:stateDic forKey:key];
         
     }] mutableCopy];
     
@@ -2879,41 +2704,6 @@
 }
 
 + (NSDictionary *)offline_getStateByCountryCodeId:(NSString *)codeId checkedState:(NSString *)stateCode {
-//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//    
-//    sqlite3 *db = [iSalesDB get_db];
-//    
-//    NSString *sqlQuery = [NSString stringWithFormat:@"select name,code from offline_state where country_code = (select code as country_code FROM offline_country where countrycode_id = %@);",codeId];
-//    
-//    DebugLog(@"query state:%@",sqlQuery);
-//    
-//    sqlite3_stmt * statement;
-//    
-//    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-//        int i = 0;
-//        while (sqlite3_step(statement) == SQLITE_ROW) {
-//            char *name = (char *) sqlite3_column_text(statement, 0); // value
-//            char *code = (char *) sqlite3_column_text(statement, 1); // value_id
-//            
-//            NSMutableDictionary *stateDic = [NSMutableDictionary dictionaryWithCapacity:2];
-//            [stateDic setValue:[NSString stringWithUTF8String:name] forKey:@"value"];
-//            [stateDic setValue:[NSString stringWithUTF8String:code] forKey:@"value_id"];
-//            [stateDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
-//            
-//            if (stateCode && [[NSString stringWithUTF8String:code] isEqualToString:stateCode]) {
-//                [stateDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
-//            }
-//            
-//            NSString *key = [NSString stringWithFormat:@"val_%d",i++];
-//            [dic setValue:stateDic forKey:key];
-//        }
-//        
-//        sqlite3_finalize(statement);
-//    }
-//    
-//    [iSalesDB close_db:db];
-//    [dic setValue:[NSNumber numberWithInt:dic.allKeys.count] forKey:@"count"];
-//    return dic;
     
     NSString *sql = [NSString stringWithFormat:@"select name,code from offline_state where country_code = (select code as country_code FROM offline_country where countrycode_id = %@);",codeId];
     
@@ -2940,39 +2730,6 @@
 }
 
 + (NSDictionary *)offline_getPrice {
-//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//    
-//    sqlite3 *db = [iSalesDB get_db];
-//    NSString *sqlQuery = [NSString stringWithFormat:@"select _id,name,type,order_by from price;"];
-//    sqlite3_stmt * statement;
-//    
-//    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-//        while (sqlite3_step(statement) == SQLITE_ROW) {
-//            char *name = (char *) sqlite3_column_text(statement, 1);
-//            int type = sqlite3_column_int(statement, 2);
-//            int orderBy = sqlite3_column_int(statement, 3);
-//            
-//            NSMutableDictionary *priceDic = [NSMutableDictionary dictionary];
-//            [priceDic setValue:[NSString stringWithUTF8String:name] forKey:@"value"];
-//            [priceDic setValue:[NSNumber numberWithInt:type] forKey:@"value_id"];
-//            NSString *key = [NSString stringWithFormat:@"val_%d",orderBy];
-//            [priceDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
-//            
-//            if (orderBy == 0) {
-//                [priceDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
-//            }
-//            
-//            [dic setValue:priceDic forKey:key];
-//        }
-//        
-//        sqlite3_finalize(statement);
-//    }
-//    
-//    [iSalesDB close_db:db];
-//    
-//    [dic setValue:[NSNumber numberWithInt:dic.allKeys.count] forKey:@"count"];
-//    
-//    return dic;
     
     NSString *sql = [NSString stringWithFormat:@"select _id,name,type,order_by from price;"];
     
@@ -3002,38 +2759,6 @@
 }
 
 + (NSDictionary *)offline_getSalesRep {
-//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//    
-//    sqlite3 *db = [iSalesDB get_db];
-//    NSString *sqlQuery = [NSString stringWithFormat:@"select _id,name,code,salesrep_id from offline_salesrep;"];
-//    sqlite3_stmt * statement;
-//    
-//    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-//        long count = 0;
-//        while (sqlite3_step(statement) == SQLITE_ROW) {
-//            // 1 name 2 code 3 salesrep_id
-//            char *name = (char *)sqlite3_column_text(statement, 1);
-//            char *code = (char *)sqlite3_column_text(statement, 2);
-//            int salesrep_id = sqlite3_column_int(statement, 3);
-//            //            int _id = sqlite3_column_int(statement, 0);
-//            //
-//            //            "val_0" : {
-//            //                "value" : "BBSC - BARBARA BORROUGHS",
-//            //                "value_id" : 121
-//            //            },
-//            NSMutableDictionary *repDic = [NSMutableDictionary dictionary];
-//            [repDic setValue:[NSString stringWithFormat:@"%s - %s",code,name] forKey:@"value"];
-//            [repDic setValue:[NSNumber numberWithInt:salesrep_id] forKey:@"value_id"];
-//            [dic setValue:repDic forKey:[NSString stringWithFormat:@"val_%ld",count++]];
-//        }
-//        
-//        sqlite3_finalize(statement);
-//    }
-//    [iSalesDB close_db:db];
-//    
-//    [dic setValue:[NSNumber numberWithInt:dic.allKeys.count] forKey:@"count"];
-//    
-//    return dic;
     
     NSString *sql = [NSString stringWithFormat:@"select _id,name,code,salesrep_id from offline_salesrep;"];
     NSMutableDictionary *ret = [[iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
@@ -3042,7 +2767,7 @@
         char *name = (char *)sqlite3_column_text(stmt, 1);
         char *code = (char *)sqlite3_column_text(stmt, 2);
         int salesrep_id = sqlite3_column_int(stmt, 3);
-
+        
         NSMutableDictionary *repDic = [NSMutableDictionary dictionary];
         [repDic setValue:[NSString stringWithFormat:@"%s - %s",code,name] forKey:@"value"];
         [repDic setValue:[NSNumber numberWithInt:salesrep_id] forKey:@"value_id"];
@@ -3055,6 +2780,30 @@
     return ret;
 }
 
++ (NSDictionary *)offline_dealZipCode:(NSString *)zipcode {
+    
+    NSString *sql = [NSString stringWithFormat:@"select country,state,city,country_code,state_code from offline_zipcode where zipcode = '%@';",zipcode];
+    
+    NSMutableDictionary *ret = [[iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
+        
+        char *country = (char *)sqlite3_column_text(stmt, 0);
+        char *state = (char *)sqlite3_column_text(stmt, 1);
+        char *city = (char *)sqlite3_column_text(stmt, 2);
+        char *country_code = (char *)sqlite3_column_text(stmt, 3);
+        char *state_code = (char *)sqlite3_column_text(stmt, 4);
+        
+        [container setValue:[NSString stringWithUTF8String:country] forKey:@"country"];
+        [container setValue:[NSString stringWithUTF8String:state] forKey:@"state"];
+        [container setValue:[NSString stringWithUTF8String:city] forKey:@"city"];
+        [container setValue:[NSString stringWithUTF8String:country_code] forKey:@"country_code"];
+        [container setValue:[NSString stringWithUTF8String:state_code] forKey:@"state_code"];
+        
+    }] mutableCopy];
+    
+    return ret;
+}
+
+
 + (void)setValue:(id)value forItemKey:(NSString *)itemKey valueKey:(NSString *)valueKey inDictionary:(NSMutableDictionary *)dic{
     
     NSMutableDictionary *item = [[dic objectForKey:itemKey] mutableCopy];
@@ -3105,65 +2854,102 @@
     return ret;
 }
 
-+ (NSDictionary *)offline_dealZipCode:(NSString *)zipcode {
-//    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-//    
-//    sqlite3 *db = [iSalesDB get_db];
-//    NSString *sqlQuery = [NSString stringWithFormat:@"select country,state,city,country_code,state_code from offline_zipcode where zipcode = '%@';",zipcode];
-//    sqlite3_stmt * statement;
-//    
-//    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-//        while (sqlite3_step(statement) == SQLITE_ROW) {
-//            char *country = (char *)sqlite3_column_text(statement, 0);
-//            char *state = (char *)sqlite3_column_text(statement, 1);
-//            char *city = (char *)sqlite3_column_text(statement, 2);
-//            char *country_code = (char *)sqlite3_column_text(statement, 3);
-//            char *state_code = (char *)sqlite3_column_text(statement, 4);
-//            
-//            [dic setValue:[NSString stringWithUTF8String:country] forKey:@"country"];
-//            [dic setValue:[NSString stringWithUTF8String:state] forKey:@"state"];
-//            [dic setValue:[NSString stringWithUTF8String:city] forKey:@"city"];
-//            [dic setValue:[NSString stringWithUTF8String:country_code] forKey:@"country_code"];
-//            [dic setValue:[NSString stringWithUTF8String:state_code] forKey:@"state_code"];
-//        }
-//        
-//        sqlite3_finalize(statement);
-//    }
-//    [iSalesDB close_db:db];
-//
-//    return dic;
++ (NSString *)countryNameByCountryCodeId:(NSString *)codeId {
     
-    NSString *sql = [NSString stringWithFormat:@"select country,state,city,country_code,state_code from offline_zipcode where zipcode = '%@';",zipcode];
+    NSString *name = nil;
     
-    NSMutableDictionary *ret = [[iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
-        
-        char *country = (char *)sqlite3_column_text(stmt, 0);
-        char *state = (char *)sqlite3_column_text(stmt, 1);
-        char *city = (char *)sqlite3_column_text(stmt, 2);
-        char *country_code = (char *)sqlite3_column_text(stmt, 3);
-        char *state_code = (char *)sqlite3_column_text(stmt, 4);
-        
-        [container setValue:[NSString stringWithUTF8String:country] forKey:@"country"];
-        [container setValue:[NSString stringWithUTF8String:state] forKey:@"state"];
-        [container setValue:[NSString stringWithUTF8String:city] forKey:@"city"];
-        [container setValue:[NSString stringWithUTF8String:country_code] forKey:@"country_code"];
-        [container setValue:[NSString stringWithUTF8String:state_code] forKey:@"state_code"];
+    sqlite3 *db = [iSalesDB get_db];
+    NSString *sqlQuery = [NSString stringWithFormat:@"select name from offline_country where countrycode_id = %@",codeId];
+    sqlite3_stmt * statement;
+    
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
+        while (sqlite3_step(statement) == SQLITE_ROW) {
+            char *value = (char *)sqlite3_column_text(statement, 0);
+            name = [NSString stringWithUTF8String:value];
+        }
         
-    }] mutableCopy];
+        sqlite3_finalize(statement);
+    }
+    [iSalesDB close_db:db];
     
-    return ret;
+    return name;
 }
 
-+ (NSData *)offline_createContact:(NSMutableDictionary *)params {
-    
-    NSString *path = [[NSBundle mainBundle] pathForResource:@"createContact.json" ofType:nil];
-    NSData *data = [NSData dataWithContentsOfFile:path];
-    NSMutableDictionary *ret = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil] mutableCopy];
++ (NSString *)priceNameByPriceId:(NSString *)priceId {
     
-    NSMutableDictionary *section_0 = [[ret objectForKey:@"section_0"] mutableCopy];
+    NSString *ret = nil;
     
+    sqlite3 *db = [iSalesDB get_db];
+    NSString *sqlQuery = [NSString stringWithFormat:@"select name from price where order_by = %@;",priceId];
+    sqlite3_stmt * statement;
     
-    NSString *countryCode = nil;
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
+        while (sqlite3_step(statement) == SQLITE_ROW) {
+            char *name = (char *)sqlite3_column_text(statement, 0);
+            ret = [NSString stringWithUTF8String:name];
+        }
+        
+        sqlite3_finalize(statement);
+    }
+    [iSalesDB close_db:db];
+    
+    return ret;
+}
+
++ (NSString *)salesRepCodeById:(NSString *)_id {
+    
+    NSString *ret = nil;
+    
+    sqlite3 *db = [iSalesDB get_db];
+    NSString *sqlQuery = [NSString stringWithFormat:@"select code from offline_salesrep where salesrep_id = %@",_id];
+    sqlite3_stmt * statement;
+    
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
+        while (sqlite3_step(statement) == SQLITE_ROW) {
+            char *rep = (char *)sqlite3_column_text(statement, 0);
+            ret = [NSString stringWithUTF8String:rep];
+        }
+        
+        sqlite3_finalize(statement);
+    }
+    [iSalesDB close_db:db];
+    
+    
+    return ret;
+}
+
++ (NSString *)textAtColumn:(int)col statement:(sqlite3_stmt *)stmt{
+    NSString *text = [NSString stringWithFormat:@"%s",(char *)sqlite3_column_text(stmt, col)];
+    if (!text) {
+        text = @"";
+    }
+    return text;
+}
+
++ (NSMutableDictionary *)dictionaryFileName:(NSString *)name {
+    NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:nil];
+    NSData *data = [NSData dataWithContentsOfFile:path];
+    NSMutableDictionary *ret = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil] mutableCopy];
+    
+    return ret;
+}
+
++ (NSMutableDictionary *)mutableDictionary:(NSString *)key inDictionary:(NSDictionary *)dic {
+    return [[dic objectForKey:key] mutableCopy];
+}
+
+#pragma mark create new contact
+
++ (NSData *)offline_createContact:(NSMutableDictionary *)params {
+    
+    NSString *path = [[NSBundle mainBundle] pathForResource:@"createContact.json" ofType:nil];
+    NSData *data = [NSData dataWithContentsOfFile:path];
+    NSMutableDictionary *ret = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil] mutableCopy];
+    
+    NSMutableDictionary *section_0 = [[ret objectForKey:@"section_0"] mutableCopy];
+    
+    
+    NSString *countryCode = nil;
     NSString *countryCode_id = nil;
     NSString *stateCode = nil;
     NSString *city = nil;
@@ -3342,15 +3128,28 @@
     
     NSString *contact_id = [NSUUID UUID].UUIDString;
     
+    NSMutableDictionary *sync_dic = [params mutableCopy];
+    
+    NSString *sync_data = nil;
+    
     NSString *sql = nil;
     if (update){
         contact_id = [params objectForKey:@"contact_id"];
         if (!contact_id) {
             contact_id = @"";
         }
-        sql = [NSString stringWithFormat:@"update offline_contact set company_name = '%@',addr_1 = '%@',addr_2 = '%@',addr_3 = '%@',addr_4 = '%@',country = '%@',state = '%@',city = '%@',zipcode = '%@',first_name = '%@',last_name = '%@',phone = '%@',fax = '%@',email = '%@',notes = '%@',price_type = '%@',sales_rep = '%@',img_0 = '%@',img_1 = '%@',img_2 = '%@' where contact_id = '%@';",companyName,addr1,addr2,addr3,addr4,country,state,city,zipcode,fistName,lastName,phone,fax,email,notes,price,salesRep,img_0,img_1,img_2,contact_id];
-    } else
-        sql = [NSString stringWithFormat:@"insert into offline_contact (company_name,addr_1,addr_2,addr_3,addr_4,country,state,city,zipcode,first_name,last_name,phone,fax,email,notes,price_type,sales_rep,img_0,img_1,img_2,editable,contact_id,Sales_Order_Customer,Sales_Order_Freight_Bill_To,Sales_Order_Ship_From,Sales_Order_Merchandise_Bill_To,Contact_Return_To,Sales_Order_Ship_To) values ('%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@',1,'%@',1,1,0,1,0,1)",companyName,addr1,addr2,addr3,addr4,country,state,city,zipcode,fistName,lastName,phone,fax,email,notes,price,salesRep,img_0,img_1,img_2,contact_id];
+        
+        [sync_dic setValue:contact_id forKey:@"contact_id"];
+        sync_data = [RAUtils dict2string:sync_dic];
+        
+        sql = [NSString stringWithFormat:@"update offline_contact set company_name = '%@',addr_1 = '%@',addr_2 = '%@',addr_3 = '%@',addr_4 = '%@',country = '%@',state = '%@',city = '%@',zipcode = '%@',first_name = '%@',last_name = '%@',phone = '%@',fax = '%@',email = '%@',notes = '%@',price_type = '%@',sales_rep = '%@',img_0 = '%@',img_1 = '%@',img_2 = '%@' where contact_id = '%@',sync_data = '%@';",companyName,addr1,addr2,addr3,addr4,country,state,city,zipcode,fistName,lastName,phone,fax,email,notes,price,salesRep,img_0,img_1,img_2,contact_id,sync_data];
+    } else {
+        
+        [sync_dic setValue:contact_id forKey:@"contact_id"];
+        sync_data = [RAUtils dict2string:sync_dic];
+        
+        sql = [NSString stringWithFormat:@"insert into offline_contact (company_name,addr_1,addr_2,addr_3,addr_4,country,state,city,zipcode,first_name,last_name,phone,fax,email,notes,price_type,sales_rep,img_0,img_1,img_2,editable,contact_id,Sales_Order_Customer,Sales_Order_Freight_Bill_To,Sales_Order_Ship_From,Sales_Order_Merchandise_Bill_To,Contact_Return_To,Sales_Order_Ship_To,sync_data) values ('%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@',1,'%@',1,1,0,1,0,1,'%@')",companyName,addr1,addr2,addr3,addr4,country,state,city,zipcode,fistName,lastName,phone,fax,email,notes,price,salesRep,img_0,img_1,img_2,contact_id,sync_data];
+    }
     
     int result = [iSalesDB execSql:sql];
     
@@ -3362,156 +3161,13 @@
 
 #pragma mark save new contact
 
-+ (NSString *)countryNameByCountryCodeId:(NSString *)codeId {
-    
-    NSString *name = nil;
-    
-    sqlite3 *db = [iSalesDB get_db];
-    NSString *sqlQuery = [NSString stringWithFormat:@"select name from offline_country where countrycode_id = %@",codeId];
-    sqlite3_stmt * statement;
-    
-    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-        while (sqlite3_step(statement) == SQLITE_ROW) {
-            char *value = (char *)sqlite3_column_text(statement, 0);
-            name = [NSString stringWithUTF8String:value];
-        }
-        
-        sqlite3_finalize(statement);
-    }
-    [iSalesDB close_db:db];
-    
-    return name;
-}
-
-+ (NSString *)priceNameByPriceId:(NSString *)priceId {
-    
-    NSString *ret = nil;
-    
-    sqlite3 *db = [iSalesDB get_db];
-    NSString *sqlQuery = [NSString stringWithFormat:@"select name from price where order_by = %@;",priceId];
-    sqlite3_stmt * statement;
-    
-    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-        while (sqlite3_step(statement) == SQLITE_ROW) {
-            char *name = (char *)sqlite3_column_text(statement, 0);
-            ret = [NSString stringWithUTF8String:name];
-        }
-        
-        sqlite3_finalize(statement);
-    }
-    [iSalesDB close_db:db];
-
-    return ret;
-}
-
-+ (NSString *)salesRepCodeById:(NSString *)_id {
-    
-    NSString *ret = nil;
-    
-    sqlite3 *db = [iSalesDB get_db];
-    NSString *sqlQuery = [NSString stringWithFormat:@"select code from offline_salesrep where salesrep_id = %@",_id];
-    sqlite3_stmt * statement;
-    
-    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
-        while (sqlite3_step(statement) == SQLITE_ROW) {
-            char *rep = (char *)sqlite3_column_text(statement, 0);
-            ret = [NSString stringWithUTF8String:rep];
-        }
-        
-        sqlite3_finalize(statement);
-    }
-    [iSalesDB close_db:db];
-
-    
-    return ret;
-}
-
 +(NSData *) offline_saveNewContact:(NSMutableDictionary *) params
 {
-
-//    NSLog(@"%@",params);
-//    NSString *companyName = [params objectForKey:@"company"];
-//    if (companyName) {
-//        companyName = [AESCrypt fastencrypt:companyName];
-//    }
-//    
-//    NSString *addr1 = [params objectForKey:@"address"];
-//    if (addr1) {
-//        addr1 = [AESCrypt fastencrypt:addr1];
-//    }
-//    NSString *addr2 = [params objectForKey:@"address2"];
-////    if (addr2) {
-////        addr2 = [AESCrypt fastencrypt:addr2];
-////    }
-//    NSString *addr3 = [params objectForKey:@"address_3"];
-////    if (addr3) {
-////        addr3 = [AESCrypt fastencrypt:addr3];
-////    }
-//    NSString *addr4 = [params objectForKey:@"address_4"];
-////    if (addr4) {
-////        addr4 = [AESCrypt fastencrypt:addr4];
-////    }
-//    
-//    NSString *country = [params objectForKey:@"country"];
-//    if (country) {
-//        country = [self countryNameByCountryCodeId:country];
-//    }
-//    NSString *state = [params objectForKey:@"state"];
-//    NSString *city = [params objectForKey:@"city"];
-//    NSString *zipcode = [params objectForKey:@"zipcode"];
-//    
-//    NSString *fistName = [params objectForKey:@"firstname"];
-//    NSString *lastName = [params objectForKey:@"lastname"];
-//    
-//    NSString *phone = [params objectForKey:@"phone"];
-//    if (phone) {
-//        phone = [AESCrypt fastencrypt:phone];
-//    }
-//    
-//    NSString *fax = [params objectForKey:@"fax"];
-//    NSString *email = [params objectForKey:@"email"];
-//    
-//    NSString *notes = [params objectForKey:@"contact_notes"];
-//    
-//    NSString *price = [params objectForKey:@"price_name"];
-//    if (price) {
-//        price = [self priceNameByPriceId:price];
-//    }
-//    NSString *salesRep = [params objectForKey:@"sales_rep"];
-//    if (salesRep) {
-//        salesRep = [self salesRepCodeById:salesRep];
-//    }
-//    
-//    NSString *img = [params objectForKey:@"business_card"];
-//    NSArray *array = [img componentsSeparatedByString:@","];
-//    NSString *img_0 = array[0];
-//    NSString *img_1 = array[1];
-//    NSString *img_2 = array[2];
-//    
-//    NSString *contact_id = [NSUUID UUID].UUIDString;
-//    
-//    NSString *sql = [NSString stringWithFormat:@"insert into offline_contact (company_name,addr_1,addr_2,addr_3,addr_4,country,state,city,zipcode,first_name,last_name,phone,fax,email,notes,price_type,sales_rep,img_0,img_1,img_2,editable,contact_id,Sales_Order_Customer,Sales_Order_Freight_Bill_To,Sales_Order_Ship_From,Sales_Order_Merchandise_Bill_To,Contact_Return_To,Sales_Order_Ship_To) values ('%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@',1,'%@',1,1,0,1,0,1)",companyName,addr1,addr2,addr3,addr4,country,state,city,zipcode,fistName,lastName,phone,fax,email,notes,price,salesRep,img_0,img_1,img_2,contact_id];
-//    
-////    int result = [iSalesDB jk_execSql:sql withDatabase:YES];
-//    int result = [iSalesDB execSql:sql];
-//    
-//    NSString *retStr = [NSString stringWithFormat:@"{\"result\":%d,\"min_ver\":\"160409\",\"mode\":\"Regular Mode\"}",result];
-//    
-//    return [retStr dataUsingEncoding:NSUTF8StringEncoding];
-    
     return [self offline_saveContact:params update:NO];
 }
 
 #pragma mark edit contact
 
-+ (NSString *)textAtColumn:(int)col statement:(sqlite3_stmt *)stmt{
-    NSString *text = [NSString stringWithFormat:@"%s",(char *)sqlite3_column_text(stmt, col)];
-    if (!text) {
-        text = @"";
-    }
-    return text;
-}
-
 +(NSData *) offline_editContact:(NSMutableDictionary *) params
 {
 //    {
@@ -3722,12 +3378,195 @@
     return [RAUtils dict2data:ret];
 }
 
-#pragma mark - save contact
+#pragma mark save contact
 
 +(NSData *) offline_saveContact:(NSMutableDictionary *) params
 {
     return [self offline_saveContact:params update:YES];
 }
 
+#pragma mark category
+
++ (void)check:(NSString *)ck valueKey:(NSString *)valueKey inDictionary:(NSMutableDictionary *)dic{
+    if (ck) {
+        NSMutableDictionary *res = [self mutableDictionary:valueKey inDictionary:dic];
+        for (NSString *key in res.allKeys) {
+            if (![key isEqualToString:@"count"]) {
+                NSMutableDictionary *val = [self mutableDictionary:key inDictionary:res];
+                [val setValue:[NSNumber numberWithInteger:0] forKey:@"check"];
+                if ([val[@"value"] isEqualToString:ck]) {
+                    [val setValue:[NSNumber numberWithInteger:1] forKey:@"check"];
+                }
+                [res setValue:val forKey:key];
+            }
+        }
+        [dic setValue:res forKey:valueKey];
+    }
+}
+
++(NSDictionary*) offline_category :(NSMutableDictionary *) params
+{
+//    NSString* orderCode = [params valueForKey:@"orderCode"];
+    
+    NSString* category = [params valueForKey:@"category"];
+    
+    int limit = [[params valueForKey:@"limit"] intValue];
+    int offset = [[params valueForKey:@"offset"] intValue];
+    
+//    NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
+    
+    
+    NSMutableDictionary *ret = [self dictionaryFileName:@"category.json"];
+    NSMutableDictionary *filter = [[ret objectForKey:@"filter"] mutableCopy];
+    
+    
+    sqlite3 *db = [iSalesDB get_db];
+    
+    int count = [iSalesDB get_recordcount:db table:@"model" where:[NSString stringWithFormat:@"category like'%%#%@#%%'",category]];
+    
+    
+    NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where m.category like'%%#%@#%%' order by m.name limit %d offset %d ;",category,limit, offset];
+    
+//    {
+//        alert = SP;
+//        available = "Available Now";
+//        bestseller = No;
+//        category = 001;
+//        "custom_id" = 0;
+//        limit = 20;
+//        offset = 0;
+//        password = 123456;
+//        price = "Display All";
+//        "price_template" = 0;
+//        "sold_by_qty" = "Display All";
+//        "sort_by" = 0;
+//        user = EvanK;
+//    }
+    if ([params.allKeys containsObject:@"alert"]) {
+        // alert
+        [self check:params[@"alert"] valueKey:@"alert" inDictionary:filter];
+        NSString *alert = params[@"alert"];
+        
+        // available
+        [self check:params[@"available"] valueKey:@"availability" inDictionary:filter];
+        NSString *available = params[@"available"];
+        int available_count;
+        if ([available isEqualToString:@"Display All"]) {
+            available_count = -1;
+        } else if ([available isEqualToString:@"Available Now"]) {
+            available_count = 1;
+        } else {
+            available_count = 0;
+        }
+        
+        // best seller
+        [self check:params[@"bestseller"] valueKey:@"best_seller" inDictionary:filter];
+        NSString *bestSeller = params[@"bestseller"];
+        int best_intValue = bestSeller ? 1 : 0;
+        
+        // price
+        [self check:params[@"price"] valueKey:@"price" inDictionary:filter];
+        NSString *price = params[@"price"];
+        
+        // sold_by_qty : Sold in quantities of %@
+        [self check:params[@"sold_by_qty"] valueKey:@"qty" inDictionary:filter];
+        NSString *qty = params[@"sold_by_qty"];
+        if ([qty isEqualToString:@"Display All"]) {
+            qty = @"";
+        }
+#warning 分类查询未完待续。。
+        // sql query: alert     availability(int)   best_seller(int)    price    qty
+        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where m.category like'%%#%@#%%' alert = '%@' order by m.name limit %d offset %d ;",category,alert,limit, offset];
+    }
+    
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    if (!appDelegate.user) {
+        [filter setValue:@{@"count" : @(0)} forKey:@"price"];
+    }
+    
+    [ret setValue:filter forKey:@"filter"];
+    
+    DebugLog(@"offline_category sql:%@",sqlQuery);
+    sqlite3_stmt * statement;
+    [ret setValue:@"2" forKey:@"result"];
+    [ret setValue:[NSString stringWithFormat:@"%d",count] forKey:@"item_total_count"];
+    
+    NSMutableDictionary* items = [[NSMutableDictionary alloc] init];
+    //    int count=0;
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
+    {
+        
+        int i=0;
+        while (sqlite3_step(statement) == SQLITE_ROW)
+        {
+            NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
+            
+            //            char *name = (char*)sqlite3_column_text(statement, 1);
+            //            NSString *nsNameStr = [[NSString alloc]initWithUTF8String:name];
+            
+            char *name = (char*)sqlite3_column_text(statement, 0);
+            if(name==nil)
+                name="";
+            NSString *nsname = [[NSString alloc]initWithUTF8String:name];
+            
+            char *description = (char*)sqlite3_column_text(statement, 1);
+            if(description==nil)
+                description="";
+            NSString *nsdescription = [[NSString alloc]initWithUTF8String:description];
+            
+            
+            
+            int product_id = sqlite3_column_int(statement, 2);
+            
+            
+            //            char *url = (char*)sqlite3_column_text(statement, 3);
+            //            if(url==nil)
+            //                url="";
+            //            NSString *nsurl = [[NSString alloc]initWithUTF8String:url];
+            
+            int wid = sqlite3_column_int(statement, 3);
+            int closeout = sqlite3_column_int(statement, 4);
+            
+            NSMutableDictionary* imgjson=[self category_img:product_id];
+            
+            if(wid==0)
+                [item setValue:@"false" forKey:@"wish_exists"];
+            else
+                [item setValue:@"true" forKey:@"wish_exists"];
+            
+            if(closeout==0)
+                [item setValue:@"false" forKey:@"is_closeout"];
+            else
+                [item setValue:@"true" forKey:@"is_closeout"];
+            
+            [item addEntriesFromDictionary:imgjson];
+            
+            
+            // [item setValue:nsurl forKey:@"img"];
+            [item setValue:nsname forKey:@"name"];
+            [item setValue:nsdescription forKey:@"description"];
+            [item setValue:[NSString stringWithFormat:@"%d",product_id] forKey:@"product_id"];
+            [items setObject:item forKey:[NSString stringWithFormat:@"item_%d",i]];
+            i++;
+            
+        }
+        [items setValue:[NSString stringWithFormat:@"%d",i] forKey:@"count"];
+        [ret setObject:items forKey:@"items"];
+        sqlite3_finalize(statement);
+    }
+    NSLog(@"count:%d",count);
+    
+    
+    [iSalesDB close_db:db];
+    
+    
+    
+    
+    DebugLog(@"data string: %@",[RAUtils dict2string:ret] );
+    
+    return ret;
+}
+
+
 
 @end

+ 0 - 1
RedAnt ERP Mobile/common/data_provider/iSalesDB.m

@@ -381,7 +381,6 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     
     
     
-    
 }
 + (void) close_db:(sqlite3 *)db
 {

+ 4 - 0
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -9,6 +9,7 @@
 /* Begin PBXBuildFile section */
 		423A4ADC1D503A53005ECE4A /* createContact.json in Resources */ = {isa = PBXBuildFile; fileRef = 423A4ADB1D503A53005ECE4A /* createContact.json */; };
 		42969C021D52F31C00FF190A /* editContact.json in Resources */ = {isa = PBXBuildFile; fileRef = 42969C011D52F31C00FF190A /* editContact.json */; };
+		42DC31131D546FBE00BCD1C6 /* category.json in Resources */ = {isa = PBXBuildFile; fileRef = 42DC31121D546FBE00BCD1C6 /* category.json */; };
 		710274251CC606C4009FD219 /* UserListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 710274241CC606C4009FD219 /* UserListViewController.m */; };
 		7111E5721C76C557004763B3 /* customer_info_template_edit.json in Resources */ = {isa = PBXBuildFile; fileRef = 7111E5711C76C557004763B3 /* customer_info_template_edit.json */; };
 		71131F921CA1372300DBF6E2 /* SimplifiedBuyingProgramViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71131F911CA1372300DBF6E2 /* SimplifiedBuyingProgramViewController.m */; };
@@ -191,6 +192,7 @@
 /* Begin PBXFileReference section */
 		423A4ADB1D503A53005ECE4A /* createContact.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = createContact.json; sourceTree = "<group>"; };
 		42969C011D52F31C00FF190A /* editContact.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = editContact.json; sourceTree = "<group>"; };
+		42DC31121D546FBE00BCD1C6 /* category.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = category.json; sourceTree = "<group>"; };
 		56528CA8B8A71F67C2EE5366 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
 		6C826876B24EFB83AC94A464 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
 		710274231CC606C4009FD219 /* UserListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserListViewController.h; path = common/Functions/sidemenu/UserListViewController.h; sourceTree = SOURCE_ROOT; };
@@ -800,6 +802,7 @@
 				71BF06FA1D2F3CAC00981938 /* OLDataProvider.m */,
 				423A4ADB1D503A53005ECE4A /* createContact.json */,
 				42969C011D52F31C00FF190A /* editContact.json */,
+				42DC31121D546FBE00BCD1C6 /* category.json */,
 			);
 			name = utils;
 			sourceTree = "<group>";
@@ -1259,6 +1262,7 @@
 				7141DD3D1C5726B700F7DF59 /* softScanBeep.wav in Resources */,
 				7141DD341C57269B00F7DF59 /* include in Resources */,
 				7141DD601C5747CE00F7DF59 /* LICENSE in Resources */,
+				42DC31131D546FBE00BCD1C6 /* category.json in Resources */,
 				423A4ADC1D503A53005ECE4A /* createContact.json in Resources */,
 				7111E5721C76C557004763B3 /* customer_info_template_edit.json in Resources */,
 				71DF74961C57614C00F2789C /* PhotoBorder@2x.png in Resources */,

+ 112 - 0
RedAnt ERP Mobile/iSales-NPD/category.json

@@ -0,0 +1,112 @@
+{
+  "filter" : {
+    "alert" : {
+      "count" : 4,
+      "val_0" : {
+        "check" : "1",
+        "value" : "Display All",
+        "value_id" : ""
+      },
+      "val_1" : {
+        "value" : "QS",
+        "value_id" : "QS"
+      },
+      "val_2" : {
+        "value" : "ST",
+        "value_id" : "ST"
+      },
+      "val_3" : {
+        "value" : "SP",
+        "value_id" : "SP"
+      }
+    },
+    "availability" : {
+      "count" : 3,
+      "val_0" : {
+        "check" : "1",
+        "value" : "Display All",
+        "value_id" : ""
+      },
+      "val_1" : {
+        "value" : "Available Now",
+        "value_id" : "1"
+      },
+      "val_2" : {
+        "value" : "In Production",
+        "value_id" : "2"
+      }
+    },
+    "best_seller" : {
+      "count" : 2,
+      "val_0" : {
+        "value" : "Yes",
+        "value_id" : "true"
+      },
+      "val_1" : {
+        "check" : "1",
+        "value" : "No",
+        "value_id" : "false"
+      }
+    },
+    "count" : 7,
+    "model_description" : "",
+    "model_name" : "",
+    "price" : {
+      "count" : 6,
+      "val_0" : {
+        "check" : "1",
+        "value" : "Display All",
+        "value_id" : ""
+      },
+      "val_1" : {
+        "value" : "0-200",
+        "value_id" : "0-200"
+      },
+      "val_2" : {
+        "value" : "200-400",
+        "value_id" : "200-400"
+      },
+      "val_3" : {
+        "value" : "400-600",
+        "value_id" : "400-600"
+      },
+      "val_4" : {
+        "value" : "600-800",
+        "value_id" : "600-800"
+      },
+      "val_5" : {
+        "value" : "800+",
+        "value_id" : "800+"
+      }
+    },
+    "qty" : {
+      "count" : 5,
+      "val_0" : {
+        "check" : "1",
+        "value" : "Display All",
+        "value_id" : ""
+      },
+      "val_1" : {
+        "value" : "1",
+        "value_id" : "1"
+      },
+      "val_2" : {
+        "value" : "2",
+        "value_id" : "2"
+      },
+      "val_3" : {
+        "value" : "4",
+        "value_id" : "4"
+      },
+      "val_4" : {
+        "value" : "6",
+        "value_id" : "6"
+      }
+    }
+  },
+  "item_total_count" : 20,
+  "items" : {},
+  "min_ver" : "160409",
+  "mode" : "Regular Mode",
+  "result" : 2
+}