فهرست منبع

增加文件editContact.json,实现离线编辑、保存联系人;同时新增方法offline_saveContact:(NSDictionary *)params update:(BOOL)update使得离线模式下新建联系人保存和编辑联系人保存都适用。为iSalesDB增加方法:+ (NSString *)jk_queryText:(NSString *)sql

Pen Li 9 سال پیش
والد
کامیت
9ef7c0c6cb

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


+ 2 - 0
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.h

@@ -58,4 +58,6 @@
 
 //+(NSDictionary*) model_img :(int)product_id;
 //+(NSDictionary*) model_property :(int)product_id field:(NSString*) value ;
+
+
 @end

+ 356 - 59
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -3072,14 +3072,7 @@
     
     return ret;
 }
-+(NSData *) offline_saveContact:(NSMutableDictionary *) params
-{
-    return nil;
-}
-+(NSData *) offline_editContact:(NSMutableDictionary *) params
-{
-    return nil;
-}
+
 + (NSData *)offline_createContact:(NSMutableDictionary *)params {
     
     NSString *path = [[NSBundle mainBundle] pathForResource:@"createContact.json" ofType:nil];
@@ -3089,7 +3082,6 @@
     NSMutableDictionary *section_0 = [[ret objectForKey:@"section_0"] mutableCopy];
     
     
-    
     NSString *countryCode = nil;
     NSString *countryCode_id = nil;
     NSString *stateCode = nil;
@@ -3161,6 +3153,85 @@
     return [RAUtils dict2data:ret];
 }
 
+#pragma mark save
+
++ (NSData *)offline_saveContact:(NSDictionary *)params update:(BOOL)update {
+    
+    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 = nil;
+    if (update){
+        contact_id = [params objectForKey:@"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];
+    
+    int result = [iSalesDB execSql:sql];
+    
+    NSString *retStr = [NSString stringWithFormat:@"{\"result\":%d,\"min_ver\":\"160409\",\"mode\":\"Regular Mode\"}",result];
+    
+    return [retStr dataUsingEncoding:NSUTF8StringEncoding];
+}
+
+
 #pragma mark save new contact
 
 + (NSString *)countryNameByCountryCodeId:(NSString *)codeId {
@@ -3230,75 +3301,301 @@
 +(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];
+//    NSLog(@"%@",params);
+//    NSString *companyName = [params objectForKey:@"company"];
+//    if (companyName) {
+//        companyName = [AESCrypt fastencrypt:companyName];
 //    }
-    NSString *addr3 = [params objectForKey:@"address_3"];
-//    if (addr3) {
-//        addr3 = [AESCrypt fastencrypt:addr3];
+//    
+//    NSString *addr1 = [params objectForKey:@"address"];
+//    if (addr1) {
+//        addr1 = [AESCrypt fastencrypt:addr1];
 //    }
-    NSString *addr4 = [params objectForKey:@"address_4"];
-//    if (addr4) {
-//        addr4 = [AESCrypt fastencrypt:addr4];
+//    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];
     
-    NSString *country = [params objectForKey:@"country"];
-    if (country) {
-        country = [self countryNameByCountryCodeId:country];
+    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 = @"";
     }
-    NSString *state = [params objectForKey:@"state"];
-    NSString *city = [params objectForKey:@"city"];
-    NSString *zipcode = [params objectForKey:@"zipcode"];
+    return text;
+}
+
++(NSData *) offline_editContact:(NSMutableDictionary *) params
+{
+//    {
+//        "contact_id" = "CE0D2445-3C1F-40EC-B94C-A39A6900FBDA";
+//        password = 123456;
+//        user = EvanK;
+//    }
     
-    NSString *fistName = [params objectForKey:@"firstname"];
-    NSString *lastName = [params objectForKey:@"lastname"];
+    NSString *path = [[NSBundle mainBundle] pathForResource:@"editContact.json" ofType:nil];
+    NSData *data = [NSData dataWithContentsOfFile:path];
+    NSMutableDictionary *ret = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil] mutableCopy];
     
-    NSString *phone = [params objectForKey:@"phone"];
+    NSMutableDictionary *section_0 = [[ret objectForKey:@"section_0"] mutableCopy];
+    
+    NSString *countryCode = nil;
+    NSString *countryCode_id = nil;
+    NSString *stateCode = nil;
+    
+    /*------contact infor------*/
+    __block NSString *country = nil;
+    __block NSString *company_name = nil;
+    __block NSString *contact_id = params[@"contact_id"];
+    
+    __block NSString *addr_1,*addr_2,*addr_3,*addr_4;
+    __block NSString *zipcode = nil;
+    __block NSString *state = nil; // state_code
+    __block NSString *city = nil; //
+    __block NSString *firt_name,*last_name;
+    __block NSString *phone,*fax,*email;
+    __block NSString *notes,*price_type,*sales_rep;
+    __block NSString *img_0,*img_1,*img_2;
+    
+    NSString *sql = [NSString stringWithFormat:@"select country,company_name,addr_1,addr_2,addr_3,addr_4,zipcode,state,city,first_name,last_name,phone,fax,email,notes,price_type,sales_rep,img_0,img_1,img_2 from offline_contact where contact_id = '%@';",contact_id];
+    
+    [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
+        
+        country = [self textAtColumn:0 statement:stmt]; // country name
+        company_name = [self textAtColumn:1 statement:stmt];
+        addr_1 = [self textAtColumn:2 statement:stmt];
+        addr_2 = [self textAtColumn:3 statement:stmt];
+        addr_3 = [self textAtColumn:4 statement:stmt];
+        addr_4 = [self textAtColumn:5 statement:stmt];
+        zipcode = [self textAtColumn:6 statement:stmt];
+        state = [self textAtColumn:7 statement:stmt]; // state code
+        city = [self textAtColumn:8 statement:stmt];
+        firt_name = [self textAtColumn:9 statement:stmt];
+        last_name = [self textAtColumn:10 statement:stmt];
+        phone = [self textAtColumn:11 statement:stmt];
+        fax = [self textAtColumn:12 statement:stmt];
+        email = [self textAtColumn:13 statement:stmt];
+        notes = [self textAtColumn:14 statement:stmt];
+        price_type = [self textAtColumn:15 statement:stmt]; // name
+        sales_rep = [self textAtColumn:16 statement:stmt]; // code
+        img_0 = [self textAtColumn:17 statement:stmt];
+        img_1 = [self textAtColumn:18 statement:stmt];
+        img_2 = [self textAtColumn:19 statement:stmt];
+        
+    }];
+    
+    // decrypt
+    if (company_name) {
+        company_name = [AESCrypt fastdecrypt:company_name];
+    }
+    if (addr_1) {
+        addr_1 = [AESCrypt fastdecrypt:addr_1];
+    }
     if (phone) {
-        phone = [AESCrypt fastencrypt:phone];
+        phone = [AESCrypt fastdecrypt:phone];
     }
     
-    NSString *fax = [params objectForKey:@"fax"];
-    NSString *email = [params objectForKey:@"email"];
+    NSString *countrySql = [NSString stringWithFormat:@"select code from offline_country where name = '%@';",country];
+    countryCode = [iSalesDB jk_queryText:countrySql];
     
-    NSString *notes = [params objectForKey:@"contact_notes"];
+    stateCode = state;
     
-    NSString *price = [params objectForKey:@"price_name"];
-    if (price) {
-        price = [self priceNameByPriceId:price];
-    }
-    NSString *salesRep = [params objectForKey:@"sales_rep"];
-    if (salesRep) {
-        salesRep = [self salesRepCodeById:salesRep];
+    if ([params.allKeys containsObject:@"refresh_trigger"]) {
+        
+        if ([params[@"refresh_trigger"] isEqualToString:@"country"]) {
+            
+            NSString *code_id = params[@"country"];
+            countryCode_id = code_id;
+            countryCode = [self countryCodeByid:code_id];
+            
+        } else if ([params[@"refresh_trigger"] isEqualToString:@"zipcode"]) {
+            
+            NSString *zip_code = params[@"zipcode"];
+            zipcode = zip_code;
+            
+            countryCode_id = params[@"country"];
+            
+            NSDictionary *dic = [self offline_dealZipCode:zip_code];
+            
+            countryCode = [dic valueForKey:@"country_code"];
+            
+            stateCode = [dic valueForKey:@"state_code"];
+            
+            city = [dic valueForKey:@"city"];
+            
+            // zip code
+            NSMutableDictionary *zipDic = [[section_0 valueForKey:@"item_8"] mutableCopy];
+            [zipDic setValue:zipcode forKey:@"value"];
+            [section_0 setValue:zipDic forKey:@"item_8"];
+            
+        }
+        
     }
     
-    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];
+//    0		Country
+//    1		Company Name
+//    2		Contact ID
+//    3		Picture
+//    4		Address 1
+//    5		Address 2
+//    6		Address 3
+//    7		Address 4
+//    8		Zip Code
+//    9		State/Province
+//    10	City
+//    11	Contact First Name
+//    12	Contact Last Name
+//    13	Phone
+//    14	Fax
+//    15	Email
+//    16	Contact Notes
+//    17	Price Type
+//    18	Sales Rep
+
+    // country
+    NSDictionary *allCountry = [self offline_getAllCountryDefault:countryCode];
+    [self setValue:allCountry forItemKey:@"item_0" valueKey:@"cadedate" inDictionary:section_0];
     
-    NSString *contact_id = [NSUUID UUID].UUIDString;
+    // company
+    [self setValue:company_name forItemKey:@"item_1" valueKey:@"value" inDictionary:section_0];
     
-    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];
+    // contact_id
+    [self setValue:contact_id forItemKey:@"item_2" valueKey:@"value" inDictionary:section_0];
     
-//    int result = [iSalesDB jk_execSql:sql withDatabase:YES];
-    int result = [iSalesDB execSql:sql];
+    // picture
+    NSString *img_avalue = [NSString stringWithFormat:@"%@,%@,%@",img_0,img_1,img_2];
+    [self setValue:img_avalue forItemKey:@"item_3" valueKey:@"avalue" inDictionary:section_0];
+    [self setValue:img_0 forItemKey:@"item_3" valueKey:@"img_url_aname_0" inDictionary:section_0];
+    [self setValue:img_1 forItemKey:@"item_3" valueKey:@"img_url_aname_1" inDictionary:section_0];
+    [self setValue:img_2 forItemKey:@"item_3" valueKey:@"img_url_aname_2" inDictionary:section_0];
     
-    NSString *retStr = [NSString stringWithFormat:@"{\"result\":%d,\"min_ver\":\"160409\",\"mode\":\"Regular Mode\"}",result];
+    // addr 1 2 3 4
+    [self setValue:addr_1 forItemKey:@"item_4" valueKey:@"value" inDictionary:section_0];
+    [self setValue:addr_2 forItemKey:@"item_5" valueKey:@"value" inDictionary:section_0];
+    [self setValue:addr_3 forItemKey:@"item_6" valueKey:@"value" inDictionary:section_0];
+    [self setValue:addr_4 forItemKey:@"item_7" valueKey:@"value" inDictionary:section_0];
     
-    return [retStr dataUsingEncoding:NSUTF8StringEncoding];
+    // zip code
+    [self setValue:zipcode forItemKey:@"item_8" valueKey:@"value" inDictionary:section_0];
+    
+    // state
+    NSDictionary *allState = [self offline_getStateByCountryCode:countryCode checkedState:stateCode];
+    [self setValue:allState forItemKey:@"item_9" valueKey:@"cadedate" inDictionary:section_0];
+    
+    // city
+    [self setValue:city forItemKey:@"item_10" valueKey:@"value" inDictionary:section_0];
+    
+    // first last
+    [self setValue:firt_name forItemKey:@"item_11" valueKey:@"value" inDictionary:section_0];
+    [self setValue:last_name forItemKey:@"item_12" valueKey:@"value" inDictionary:section_0];
+    
+    // phone fax email
+    [self setValue:phone forItemKey:@"item_13" valueKey:@"value" inDictionary:section_0];
+    [self setValue:fax forItemKey:@"item_14" valueKey:@"value" inDictionary:section_0];
+    [self setValue:email forItemKey:@"item_15" valueKey:@"value" inDictionary:section_0];
+    
+    // notes
+    [self setValue:notes forItemKey:@"item_16" valueKey:@"value" inDictionary:section_0];
+    
+    // price
+    NSMutableDictionary *priceDic = [[self offline_getPrice] mutableCopy];
+    for (NSString *key in priceDic.allKeys) {
+        
+        if ([key containsString:@"val_"]) {
+            NSMutableDictionary *dic = [priceDic[key] mutableCopy];
+            if ([dic[@"value"] isEqualToString:price_type]) {
+                [dic setValue:[NSNumber numberWithInteger:1] forKey:@"check"];
+                [priceDic setValue:dic forKey:key];
+            }
+        }
+        
+    }
+    [self setValue:priceDic forItemKey:@"item_17" valueKey:@"cadedate" inDictionary:section_0];
+    
+    // Sales Rep
+    NSMutableDictionary *repDic = [[self offline_getSalesRep] mutableCopy];
+    for (NSString *key in repDic.allKeys) {
+        if ([key containsString:@"val_"]) {
+            NSMutableDictionary *dic = [repDic[key] mutableCopy];
+            NSString *value = dic[@"value"];
+            NSString *code = [[[value componentsSeparatedByString:@"-"] firstObject] stringByReplacingOccurrencesOfString:@" " withString:@""];
+            if (code && [code isEqualToString:sales_rep]) {
+                [dic setValue:[NSNumber numberWithInteger:1] forKey:@"check"];
+                [repDic setValue:dic forKey:key];
+            }
+        }
+    }
+    [self setValue:repDic forItemKey:@"item_18" valueKey:@"cadedate" inDictionary:section_0];
+    
+    [ret setValue:section_0 forKey:@"section_0"];
+    
+    return [RAUtils dict2data:ret];
+}
+
+#pragma mark - save contact
+
++(NSData *) offline_saveContact:(NSMutableDictionary *) params
+{
+    return [self offline_saveContact:params update:YES];
 }
 
 

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

@@ -45,5 +45,6 @@ typedef void(^queryBlock)(sqlite3_stmt *stmt,NSMutableDictionary *container,long
 
 + (NSDictionary *)jk_query:(NSString *)sql completion:(queryBlock)block;
 
++ (NSString *)jk_queryText:(NSString *)sql;
 
 @end

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

@@ -897,4 +897,25 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     return [dic copy];
 }
 
++ (NSString *)jk_queryText:(NSString *)sql{
+    
+    __block NSString *ret = nil;
+    
+    sqlite3 *db = [iSalesDB get_db];
+    NSString *sqlQuery = sql;
+    sqlite3_stmt * statement;
+    
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
+        
+        while (sqlite3_step(statement) == SQLITE_ROW) {
+            ret = [NSString stringWithFormat:@"%s",(char *)sqlite3_column_text(statement, 0)];
+        }
+        
+        sqlite3_finalize(statement);
+    }
+    sqlite3_close(db);
+    
+    return ret;
+}
+
 @end

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

@@ -8,6 +8,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 */; };
 		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 */; };
@@ -189,6 +190,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>"; };
 		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; };
@@ -797,6 +799,7 @@
 				71BF06F91D2F3CAC00981938 /* OLDataProvider.h */,
 				71BF06FA1D2F3CAC00981938 /* OLDataProvider.m */,
 				423A4ADB1D503A53005ECE4A /* createContact.json */,
+				42969C011D52F31C00FF190A /* editContact.json */,
 			);
 			name = utils;
 			sourceTree = "<group>";
@@ -1248,6 +1251,7 @@
 				713F76B41929F4A7006A7305 /* InfoPlist.strings in Resources */,
 				7162A5A01C58733400AB630E /* status_filter_cadedate_open.json in Resources */,
 				71D30A211CFBEDC6006F9477 /* default_appearance.json in Resources */,
+				42969C021D52F31C00FF190A /* editContact.json in Resources */,
 				71777FC61C8AC97300DA2511 /* debug_category_filter.json in Resources */,
 				71DF74951C57614C00F2789C /* PhotoBorder.png in Resources */,
 				7162A55F1C58724700AB630E /* customer_info_template.json in Resources */,

+ 172 - 0
RedAnt ERP Mobile/iSales-NPD/editContact.json

@@ -0,0 +1,172 @@
+{
+  "min_ver" : "160409",
+  "mode" : "Regular Mode",
+  "result" : 2,
+  "section_0" : {
+    "count" : 19,
+    "item_0" : {
+      "aname" : "Country",
+      "cadedate" : "",
+      "control" : "enum",
+      "name" : "country",
+      "refresh" : 1,
+      "restore" : {
+        "count" : 3,
+        "item_0" : "state",
+        "item_1" : "city",
+        "item_2" : "zipcode"
+      },
+      "single_select" : "true"
+    },
+    "item_1" : {
+      "aname" : "Company Name",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "company",
+      "required" : "true",
+      "value" : ""
+    },
+    "item_10" : {
+      "aname" : "City",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "city",
+      "value" : ""
+    },
+    "item_11" : {
+      "aname" : "Contact First Name",
+      "capital" : "1",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "firstname",
+      "value" : ""
+    },
+    "item_12" : {
+      "aname" : "Contact Last Name",
+      "capital" : "1",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "lastname",
+      "value" : ""
+    },
+    "item_13" : {
+      "aname" : "Phone",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "phone",
+      "required" : "true",
+      "value" : ""
+    },
+    "item_14" : {
+      "aname" : "Fax",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "fax",
+      "value" : ""
+    },
+    "item_15" : {
+      "aname" : "Email",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "email",
+      "value" : ""
+    },
+    "item_16" : {
+      "aname" : "Contact Notes",
+      "control" : "text_view",
+      "name" : "contact_notes",
+      "value" : ""
+    },
+    "item_17" : {
+      "aname" : "Price Type",
+      "cadedate" : "",
+      "control" : "enum",
+      "name" : "price_name",
+      "single_select" : "false"
+    },
+    "item_18" : {
+      "aname" : "Sales Rep",
+      "cadedate" : "",
+      "control" : "enum",
+      "max" : "3",
+      "name" : "sales_rep",
+      "single_select" : "true"
+    },
+    "item_2" : {
+      "aname" : "Contact ID",
+      "control" : "edit",
+      "disable" : 1,
+      "name" : "contact_id",
+      "value" : ""
+    },
+    "item_3" : {
+      "aname" : "Picture",
+      "avalue" : "",
+      "control" : "img",
+      "img_url_0" : "",
+      "img_url_1" : "",
+      "img_url_2" : "",
+      "img_url_aname_0" : "",
+      "img_url_aname_1" : "",
+      "img_url_aname_2" : "",
+      "name" : "business_card"
+    },
+    "item_4" : {
+      "aname" : "Address 1",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "address",
+      "value" : ""
+    },
+    "item_5" : {
+      "aname" : "Address 2",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "address2",
+      "value" : ""
+    },
+    "item_6" : {
+      "aname" : "Address 3",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "address_3",
+      "value" : ""
+    },
+    "item_7" : {
+      "aname" : "Address 4",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "address_4",
+      "value" : ""
+    },
+    "item_8" : {
+      "aname" : "Zip Code",
+      "control" : "edit",
+      "keyboard" : "text",
+      "name" : "zipcode",
+      "refresh" : 1,
+      "restore" : {
+        "count" : 3,
+        "item_0" : "state",
+        "item_1" : "city",
+        "item_2" : "country"
+      },
+      "value" : ""
+    },
+    "item_9" : {
+      "aname" : "State/Province",
+      "cadedate" : "",
+      "control" : "enum",
+      "name" : "state",
+      "single_select" : "true"
+    },
+    "title" : "* field is required"
+  },
+  "section_count" : 1,
+  "title" : "Edit Customer",
+  "up_params" : {
+    "count" : 2,
+    "val_0" : "zipcode",
+    "val_1" : "country"
+  }
+}