|
|
@@ -891,7 +891,7 @@
|
|
|
data[@"sales_terms"]=sales_terms;
|
|
|
data[@"port_destination"]=port_destination;
|
|
|
data[@"terms"]=terms;
|
|
|
- data[@"carrier"]=carrier;
|
|
|
+ data[@"truck_carrier"]=carrier;
|
|
|
data[@"vendor_no"]=vendor_no;
|
|
|
data[@"customer_sign"]=sign_picpath;
|
|
|
data[@"print_status"]=print_status;
|
|
|
@@ -1957,6 +1957,31 @@
|
|
|
}
|
|
|
return submitlist;
|
|
|
}
|
|
|
+//+(NSMutableDictionary*) getScanOrderList:(NSString*)userdir{
|
|
|
+//// NSString *userdir = [self getUserPath:user];
|
|
|
+// NSMutableDictionary* orderlist = nil;
|
|
|
+// NSString *orderlistPath = [userdir stringByAppendingPathComponent:@"orderlist.json"];
|
|
|
+//
|
|
|
+// if (![[NSFileManager defaultManager] fileExistsAtPath:orderlistPath]) {
|
|
|
+//
|
|
|
+//
|
|
|
+// orderlist = [NSMutableDictionary new];
|
|
|
+//
|
|
|
+// // [orderlist addObject:appDelegate.order_code];
|
|
|
+// // [RAUtils dicttofile:orderlistPath dict:orderlist];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// orderlist=[[RAUtils dictfromfile:orderlistPath] mutableCopy];
|
|
|
+//
|
|
|
+// // [orderlist insertObject:appDelegate.order_code atIndex:0];
|
|
|
+//
|
|
|
+// // [RAUtils dicttofile:orderlistPath dict:orderlist];
|
|
|
+// }
|
|
|
+// return orderlist;
|
|
|
+//}
|
|
|
+
|
|
|
+(NSMutableDictionary*) getScanOrderList{
|
|
|
NSString *userdir = [OLDataProvider getUserPath];
|
|
|
NSMutableDictionary* orderlist = nil;
|
|
|
@@ -2272,7 +2297,20 @@
|
|
|
////
|
|
|
//
|
|
|
//}
|
|
|
-
|
|
|
+//+(NSString*) getUserPath: (NSString*) user
|
|
|
+//{
|
|
|
+// NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
|
+// NSString *documents = [paths objectAtIndex:0];
|
|
|
+//
|
|
|
+// NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];
|
|
|
+//
|
|
|
+// NSString* servername = addressDic[@"name"];
|
|
|
+//// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+//// NSString* user = appDelegate.user;
|
|
|
+// NSString* userpath = [documents stringByAppendingPathComponent:servername];
|
|
|
+// userpath = [userpath stringByAppendingPathComponent:user];
|
|
|
+// return userpath;
|
|
|
+//}
|
|
|
+(NSString*) getUserPath
|
|
|
{
|
|
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
|
@@ -2281,8 +2319,9 @@
|
|
|
NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];
|
|
|
|
|
|
NSString* servername = addressDic[@"name"];
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- NSString* user = appDelegate.user;
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// NSString* user = appDelegate.user;
|
|
|
+ NSString* user = RASingleton.sharedInstance.user;
|
|
|
NSString* userpath = [documents stringByAppendingPathComponent:servername];
|
|
|
userpath = [userpath stringByAppendingPathComponent:user];
|
|
|
return userpath;
|
|
|
@@ -2483,6 +2522,7 @@
|
|
|
+(void) updateScanOrder:(NSString*) order_code
|
|
|
{
|
|
|
|
|
|
+#ifdef SCANNER_ORDER
|
|
|
NSString *userdir = [OLDataProvider getUserPath];
|
|
|
|
|
|
if(order_code.length==0)
|
|
|
@@ -2543,17 +2583,18 @@
|
|
|
p+=[cartitem[@"unit_price"] doubleValue]*[cartitem[@"count"]intValue] * (1-[cartitem[@"discount"]doubleValue]/100.0);
|
|
|
int mcount = [cartitem[@"count"] intValue];
|
|
|
double msurcharge =0;
|
|
|
- if(RASingleton.sharedInstance.price_type==1)
|
|
|
- {
|
|
|
- if([cartitem[@"special_price"] boolValue])
|
|
|
- {
|
|
|
- msurcharge=([cartitem[price_group[@"price_3"][@"name"]] doubleValue]-[cartitem[price_group[@"price_2"][@"name"]] doubleValue])*mcount*(1-[cartitem[@"discount"]doubleValue]/100.0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- msurcharge=([cartitem[price_group[@"price_3"][@"name"]] doubleValue]-[cartitem[price_group[@"price_1"][@"name"]] doubleValue])*mcount*(1-[cartitem[@"discount"]doubleValue]/100.0);
|
|
|
- }
|
|
|
- }
|
|
|
+ // remove net price
|
|
|
+// if(RASingleton.sharedInstance.price_type==1)
|
|
|
+// {
|
|
|
+// if([cartitem[@"special_price"] boolValue])
|
|
|
+// {
|
|
|
+// msurcharge=([cartitem[price_group[@"price_3"][@"name"]] doubleValue]-[cartitem[price_group[@"price_2"][@"name"]] doubleValue])*mcount*(1-[cartitem[@"discount"]doubleValue]/100.0);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// msurcharge=([cartitem[price_group[@"price_3"][@"name"]] doubleValue]-[cartitem[price_group[@"price_1"][@"name"]] doubleValue])*mcount*(1-[cartitem[@"discount"]doubleValue]/100.0);
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
s+=msurcharge;
|
|
|
}
|
|
|
@@ -2585,7 +2626,7 @@
|
|
|
// [RAUtils dicttofile:orderlistPath dict:orderlist];
|
|
|
|
|
|
[ActiveViewController Notify:@"ScanOrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
-
|
|
|
+#endif
|
|
|
}
|
|
|
+(void) deleteScanOrder:(NSString*) order_code
|
|
|
{
|
|
|
@@ -2780,6 +2821,9 @@
|
|
|
{
|
|
|
// if(RASingleton.sharedInstance.price_type==1)
|
|
|
_modelJson [@"net_price"] = @true;
|
|
|
+
|
|
|
+ // remove net price
|
|
|
+ _modelJson [@"net_price"] = @false;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -3391,7 +3435,8 @@ if(stockUom==0)
|
|
|
if(sync_data!=nil)
|
|
|
{
|
|
|
nssync_data= [[NSString alloc]initWithUTF8String:sync_data];
|
|
|
-
|
|
|
+// NSMutableDictionary* sync_dic = [RAConvertor string2dict:sync_data];
|
|
|
+// sync_dic[@"truck_carrier"] = sync_dic[@"carrier"]
|
|
|
}
|
|
|
char *img_1 = (char*)sqlite3_column_text(statement, 2);
|
|
|
NSString* nsimg_1=nil;
|
|
|
@@ -5375,6 +5420,7 @@ if(stockUom==0)
|
|
|
double cuft=0;
|
|
|
double weight=0;
|
|
|
int carton=0;
|
|
|
+ int impack=0;
|
|
|
|
|
|
|
|
|
NSString *sqlQuery = [NSString stringWithFormat:@"select ulength ,uwidth ,uheight ,uweight ,mlength ,mwidth ,mheight ,mweigth ,ilength ,iwidth ,iheight , iweight ,pcs ,mpack ,ipack,ucbf,icbf,mcbf from catalog where item_id=%d;",item_id];
|
|
|
@@ -5400,6 +5446,7 @@ if(stockUom==0)
|
|
|
double iweight = sqlite3_column_double(statement, 11);
|
|
|
// int pcs = sqlite3_column_int(statement,12);
|
|
|
int mpack = sqlite3_column_int(statement, 13);
|
|
|
+ impack = mpack;
|
|
|
int ipack = sqlite3_column_int(statement, 14);
|
|
|
double ucbf = sqlite3_column_double(statement, 15);
|
|
|
// double icbf = sqlite3_column_double(statement, 16);
|
|
|
@@ -5493,6 +5540,7 @@ if(stockUom==0)
|
|
|
}
|
|
|
}
|
|
|
ret[@"cuft"]= [NSNumber numberWithDouble:cuft];
|
|
|
+ ret[@"mpack"]= [NSNumber numberWithInteger:impack];
|
|
|
ret[@"weight"]= [NSNumber numberWithDouble:weight];
|
|
|
ret[@"carton"]= [NSNumber numberWithInteger:carton];
|
|
|
ret[@"items"]=dict_item;
|
|
|
@@ -5890,7 +5938,7 @@ if(stockUom==0)
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
@@ -5903,7 +5951,7 @@ if(stockUom==0)
|
|
|
|
|
|
|
|
|
{
|
|
|
- sqlQuery=[NSString stringWithFormat:@"select editable,company_name,country,addr,zipcode,state,city,contact_name,phone,contact_id,addr_1,addr_2,addr_3,addr_4,first_name,last_name,fax,email,img_0,img_1,img_2,price_type,notes,sales_rep,type from offline_contact where contact_id='%@'",contactId];
|
|
|
+ sqlQuery=[NSString stringWithFormat:@"select editable,company_name,country,addr,zipcode,state,city,contact_name,phone,contact_id,addr_1,addr_2,addr_3,addr_4,first_name,last_name,fax,email,img_0,img_1,img_2,price_type,notes,sales_rep,type,carrier from offline_contact where contact_id='%@'",contactId];
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -5915,6 +5963,8 @@ if(stockUom==0)
|
|
|
[ret setValue:@"2" forKey:@"result"];
|
|
|
|
|
|
|
|
|
+ int carrier = -1;
|
|
|
+
|
|
|
if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
|
|
|
{
|
|
|
|
|
|
@@ -5924,7 +5974,7 @@ if(stockUom==0)
|
|
|
|
|
|
[ret setValue:[NSNumber numberWithInt:AP_USER_AUTH ] forKey:@"result"];
|
|
|
|
|
|
- NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
|
|
|
+
|
|
|
|
|
|
|
|
|
// int editable = sqlite3_column_int(statement, 0);
|
|
|
@@ -6085,6 +6135,10 @@ if(stockUom==0)
|
|
|
|
|
|
NSString *contact_type = [self textAtColumn:24 statement:statement];
|
|
|
|
|
|
+ carrier = sqlite3_column_int(statement, 25);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
{
|
|
|
// decrypt
|
|
|
@@ -6153,13 +6207,16 @@ if(stockUom==0)
|
|
|
[item setValue:nsemail forKey:@"customer_email"];
|
|
|
[item setValue:contact_type forKey:@"customer_contact_type"];
|
|
|
|
|
|
-
|
|
|
- [ret setObject:item forKey:@"customerInfo"];
|
|
|
+
|
|
|
// i++;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// UIApplication * app = [UIApplication sharedApplication];
|
|
|
// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
[ret setValue:params[@"mode"] forKey:@"mode"];
|
|
|
@@ -6174,7 +6231,12 @@ if(stockUom==0)
|
|
|
|
|
|
[iSalesDB close_db:db];
|
|
|
|
|
|
+ NSString* scarrier = [self offline_getCarrier:carrier];
|
|
|
+
|
|
|
|
|
|
+ item[@"customer_truck_carrier"] = scarrier;
|
|
|
+
|
|
|
+ [ret setObject:item forKey:@"customerInfo"];
|
|
|
|
|
|
|
|
|
DebugLog(@"data string: %@",[RAConvertor dict2string:ret] );
|
|
|
@@ -7017,6 +7079,133 @@ if(stockUom==0)
|
|
|
[ret setValue:[NSNumber numberWithLong:ret.allKeys.count] forKey:@"count"];
|
|
|
return ret;
|
|
|
}
|
|
|
++ (NSDictionary *)offline_OrderCarrier:(NSString *)order_code db:(sqlite3 *)db {
|
|
|
+ // "val_227" : {
|
|
|
+ // "check" : 1,
|
|
|
+ // "value" : "US United States",
|
|
|
+ // "value_id" : "228"
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
+ __block NSString* OrderCarrier =@"";
|
|
|
+
|
|
|
+// sqlite3 *db = [iSalesDB get_db];
|
|
|
+
|
|
|
+// sqlite3_stmt * statement;
|
|
|
+
|
|
|
+
|
|
|
+ [iSalesDB jk_query:[NSString stringWithFormat:@"select carrier from offline_order where so_id='%@';",order_code] db:db close:NO completion:^(sqlite3_stmt *statment, NSMutableDictionary *container, long *count) {
|
|
|
+
|
|
|
+ OrderCarrier = [self textAtColumn:0 statement:statment];
|
|
|
+// sqlite3_finalize(statement);
|
|
|
+
|
|
|
+ }];
|
|
|
+// [iSalesDB close_db:db];
|
|
|
+
|
|
|
+ __block int c=0;
|
|
|
+
|
|
|
+ NSMutableDictionary *ret = [[iSalesDB jk_query:@"select _id,name,code_id from carrier order by name;" db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
+
|
|
|
+ char *name = (char *) sqlite3_column_text(stmt, 1); // 全称
|
|
|
+ int code_id = sqlite3_column_int(stmt, 2); // id
|
|
|
+
|
|
|
+ NSMutableDictionary *carrierDic = [NSMutableDictionary dictionaryWithCapacity:2];
|
|
|
+ [carrierDic setValue:[NSString stringWithFormat:@"%s",name] forKey:@"value"];
|
|
|
+ [carrierDic setValue:[NSString stringWithFormat:@"%d",code_id] forKey:@"value_id"];
|
|
|
+ [carrierDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
|
|
|
+
|
|
|
+ if ([OrderCarrier isEqualToString:[NSString stringWithUTF8String:name]]) {
|
|
|
+ [carrierDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
|
|
|
+ }
|
|
|
+ c++;
|
|
|
+ long n = *count;
|
|
|
+ *count = n + 1;
|
|
|
+ NSString *key = [NSString stringWithFormat:@"val_%ld",n];
|
|
|
+ [container setValue:carrierDic forKey:key];
|
|
|
+
|
|
|
+ }] mutableCopy];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [ret setValue:[NSNumber numberWithLong:c] forKey:@"count"];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
++ (NSDictionary *)offline_getAllCarrier:(NSString *)carrierName {
|
|
|
+ // "val_227" : {
|
|
|
+ // "check" : 1,
|
|
|
+ // "value" : "US United States",
|
|
|
+ // "value_id" : "228"
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary *ret = [[iSalesDB jk_query:@"select _id,name,code_id from carrier order by name;" completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container,long *count) {
|
|
|
+ char *name = (char *) sqlite3_column_text(stmt, 1); // 全称
|
|
|
+ int code_id = sqlite3_column_int(stmt, 2); // id
|
|
|
+
|
|
|
+ NSMutableDictionary *carrierDic = [NSMutableDictionary dictionaryWithCapacity:2];
|
|
|
+ [carrierDic setValue:[NSString stringWithFormat:@"%s",name] forKey:@"value"];
|
|
|
+ [carrierDic setValue:[NSString stringWithFormat:@"%d",code_id] forKey:@"value_id"];
|
|
|
+ [carrierDic setValue:[NSNumber numberWithInt:0] forKey:@"check"];
|
|
|
+
|
|
|
+ if ([carrierName isEqualToString:[NSString stringWithUTF8String:name]]) {
|
|
|
+ [carrierDic setValue:[NSNumber numberWithInt:1] forKey:@"check"];
|
|
|
+ }
|
|
|
+
|
|
|
+ long n = *count;
|
|
|
+ *count = n + 1;
|
|
|
+ NSString *key = [NSString stringWithFormat:@"val_%ld",n];
|
|
|
+ [container setValue:carrierDic forKey:key];
|
|
|
+ }] mutableCopy];
|
|
|
+
|
|
|
+ [ret setValue:[NSNumber numberWithLong:ret.allKeys.count] forKey:@"count"];
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+//+ (NSString *)offline_getContactCarrier:(int)contact_id {
|
|
|
+// // "val_227" : {
|
|
|
+// // "check" : 1,
|
|
|
+// // "value" : "US United States",
|
|
|
+// // "value_id" : "228"
|
|
|
+// // },
|
|
|
+//
|
|
|
+// NSString *Sql = [NSString stringWithFormat: @"select carrier from offline_contact where contact_id = %d;",contact_id];
|
|
|
+// NSString * code = [iSalesDB jk_queryText:Sql];
|
|
|
+//
|
|
|
+// return [self offline_getCarrier:code];
|
|
|
+//
|
|
|
+//}
|
|
|
++ (NSString *)offline_getCarrier:(int)code {
|
|
|
+ // "val_227" : {
|
|
|
+ // "check" : 1,
|
|
|
+ // "value" : "US United States",
|
|
|
+ // "value_id" : "228"
|
|
|
+ // },
|
|
|
+
|
|
|
+ NSString *Sql = [NSString stringWithFormat: @"select name from carrier where code_id = %d;",code];
|
|
|
+ NSString * ret = [iSalesDB jk_queryText:Sql];
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
++ (int )offline_getCarrierCode:(NSString*)name {
|
|
|
+ // "val_227" : {
|
|
|
+ // "check" : 1,
|
|
|
+ // "value" : "US United States",
|
|
|
+ // "value_id" : "228"
|
|
|
+ // },
|
|
|
+
|
|
|
+ NSString *Sql = [NSString stringWithFormat: @"select code from carrier where name = '%@';",name];
|
|
|
+ NSString * ret = [iSalesDB jk_queryText:Sql];
|
|
|
+
|
|
|
+ return [ret intValue];
|
|
|
+}
|
|
|
|
|
|
+ (NSDictionary *)offline_getStateByCountryCode:(NSString *)countryCode checkedState:(NSString *)state_code{
|
|
|
countryCode = [self translateSingleQuote:countryCode];
|
|
|
@@ -7542,6 +7731,7 @@ if(stockUom==0)
|
|
|
NSString *stateCode = nil;
|
|
|
NSString *city = nil;
|
|
|
NSString *zipCode = nil;
|
|
|
+ NSString *carrierCode = nil;
|
|
|
|
|
|
if ([params.allKeys containsObject:@"refresh_trigger"]) {
|
|
|
|
|
|
@@ -7639,6 +7829,12 @@ if(stockUom==0)
|
|
|
NSDictionary *repDic = [self offline_getSalesRep:params[@"user"]];
|
|
|
[self setValue:repDic forItemKey:@"item_18" valueKey:@"cadedate" inDictionary:section_0];
|
|
|
|
|
|
+#ifdef BUILD_CONTRAST
|
|
|
+ //carrier
|
|
|
+ NSDictionary *carrierDic = [self offline_getAllCarrier:params[@"carrier"]];
|
|
|
+ [self setValue:carrierDic forItemKey:@"item_19" valueKey:@"cadedate" inDictionary:section_0];
|
|
|
+#endif
|
|
|
+
|
|
|
[ret setValue:section_0 forKey:@"section_0"];
|
|
|
|
|
|
return [RAConvertor dict2data:ret];
|
|
|
@@ -7650,7 +7846,7 @@ if(stockUom==0)
|
|
|
|
|
|
NSString *addr = nil;
|
|
|
NSString *contact_name = nil;
|
|
|
-
|
|
|
+// int carrier = [params[@"carrier"] intValue];
|
|
|
NSString *companyName = [params objectForKey:@"company"];
|
|
|
if (companyName) {
|
|
|
companyName = [AESCrypt fastencrypt:companyName];
|
|
|
@@ -7703,6 +7899,12 @@ if(stockUom==0)
|
|
|
} else {
|
|
|
country = @"";
|
|
|
}
|
|
|
+
|
|
|
+ int carrier = [params[@"carrier"] intValue];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
DebugLog(@"country");
|
|
|
country = [self translateSingleQuote:country];
|
|
|
|
|
|
@@ -7843,6 +8045,8 @@ if(stockUom==0)
|
|
|
[sync_dic setValue:@"Sales_Order_Ship_To" forKey:@"contactType"];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ sync_dic[@"truck_carrier"] = [self offline_getCarrier: [sync_dic[@"carrier"] intValue]];
|
|
|
NSString *sync_data = nil;
|
|
|
|
|
|
NSString *sql = nil;
|
|
|
@@ -7858,7 +8062,7 @@ if(stockUom==0)
|
|
|
sync_data = [RAConvertor dict2string:sync_dic];
|
|
|
sync_data = [self translateSingleQuote:sync_data];
|
|
|
|
|
|
- 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 = '%@',sync_data = '%@',contact_name = '%@',addr = '%@',type = '%@' 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,sync_data,contact_name,addr,contact_type,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 = '%@',sync_data = '%@',contact_name = '%@',addr = '%@',type = '%@' ,carrier = %d 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,sync_data,contact_name,addr,contact_type,carrier,contact_id];
|
|
|
} else {
|
|
|
|
|
|
contact_id = [self translateSingleQuote:contact_id];
|
|
|
@@ -7868,7 +8072,7 @@ if(stockUom==0)
|
|
|
sync_data = [RAConvertor dict2string:sync_dic];
|
|
|
sync_data = [self translateSingleQuote:sync_data];
|
|
|
|
|
|
- sql = [NSString stringWithFormat:@"insert into offline_contact (is_active,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,contact_name,addr,type) values (1,'%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@',1,'%@',%d,%d,0,%d,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,isCustomer ? 1 : 0,isCustomer ? 1 : 0,isCustomer ? 1 : 0,sync_data,contact_name,addr,contact_type];
|
|
|
+ sql = [NSString stringWithFormat:@"insert into offline_contact (is_active,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,contact_name,addr,type,carrier) values (1,'%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@',1,'%@',%d,%d,0,%d,0,1,'%@','%@','%@','%@',%d)",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,isCustomer ? 1 : 0,isCustomer ? 1 : 0,isCustomer ? 1 : 0,sync_data,contact_name,addr,contact_type,carrier];
|
|
|
}
|
|
|
|
|
|
int result = [iSalesDB execSql:sql];
|
|
|
@@ -7908,6 +8112,7 @@ if(stockUom==0)
|
|
|
NSString *countryCode = nil;
|
|
|
NSString *countryCode_id = nil;
|
|
|
NSString *stateCode = nil;
|
|
|
+ __block int carrierCode = -1;
|
|
|
|
|
|
/*------contact infor------*/
|
|
|
__block NSString *country = nil;
|
|
|
@@ -7925,7 +8130,7 @@ if(stockUom==0)
|
|
|
__block NSString *contact_type;
|
|
|
|
|
|
contact_id = [self translateSingleQuote:contact_id];
|
|
|
- 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,type from offline_contact where contact_id = '%@';",contact_id];
|
|
|
+ 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,type,carrier from offline_contact where contact_id = '%@';",contact_id];
|
|
|
|
|
|
[iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
|
@@ -7950,6 +8155,7 @@ if(stockUom==0)
|
|
|
img_1 = [self textAtColumn:18 statement:stmt];
|
|
|
img_2 = [self textAtColumn:19 statement:stmt];
|
|
|
contact_type = [self textAtColumn:20 statement:stmt];
|
|
|
+ carrierCode = sqlite3_column_int(stmt, 21);
|
|
|
}];
|
|
|
|
|
|
// decrypt
|
|
|
@@ -8133,6 +8339,15 @@ if(stockUom==0)
|
|
|
}
|
|
|
[self setValue:repDic forItemKey:@"item_19" valueKey:@"cadedate" inDictionary:section_0];
|
|
|
|
|
|
+#ifdef BUILD_CONTRAST
|
|
|
+ //carrier
|
|
|
+
|
|
|
+ NSString* scarrier = [self offline_getCarrier:carrierCode];
|
|
|
+ NSDictionary *carrierDic = [self offline_getAllCarrier:scarrier];
|
|
|
+ [self setValue:carrierDic forItemKey:@"item_20" valueKey:@"cadedate" inDictionary:section_0];
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
[ret setValue:section_0 forKey:@"section_0"];
|
|
|
|
|
|
return [RAConvertor dict2data:ret];
|
|
|
@@ -11126,6 +11341,9 @@ if(stockUom==0)
|
|
|
double cuft=[bsubtotaljson[@"cuft"] doubleValue];
|
|
|
double weight=[bsubtotaljson[@"weight"] doubleValue];
|
|
|
int carton=[bsubtotaljson[@"carton"] intValue];
|
|
|
+ int mpack=[bsubtotaljson[@"mpack"] intValue];
|
|
|
+
|
|
|
+ model_dic[@"mpack"]=[NSNumber numberWithInt:mpack];
|
|
|
|
|
|
TotalCuft += cuft;
|
|
|
TotalWeight += weight;
|
|
|
@@ -11435,10 +11653,11 @@ if(stockUom==0)
|
|
|
NSString *orderCode = [self valueInParams:params key:@"orderCode"];
|
|
|
orderCode = [self translateSingleQuote:orderCode];
|
|
|
|
|
|
- NSString *sql = [NSString stringWithFormat:@"select logist,lift_gate,logistic_note from offline_order where so_id = '%@';",orderCode];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select logist,lift_gate,logistic_note,carrier from offline_order where so_id = '%@';",orderCode];
|
|
|
|
|
|
|
|
|
__block NSString *logist = @"";
|
|
|
+ __block NSString *carrier = @"";
|
|
|
__block NSString *lift_gate = @"";
|
|
|
__block int lift_gate_integer = 0;
|
|
|
__block NSString *logistic_note = @"";
|
|
|
@@ -11449,6 +11668,7 @@ if(stockUom==0)
|
|
|
lift_gate_integer = sqlite3_column_int(stmt, 1);
|
|
|
|
|
|
logistic_note = [self textAtColumn:2 statement:stmt];
|
|
|
+ carrier = [self textAtColumn:3 statement:stmt];
|
|
|
|
|
|
}];
|
|
|
|
|
|
@@ -11542,17 +11762,38 @@ if(stockUom==0)
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// carrier = [self valueInParams:params key:@"carrier"];
|
|
|
+// if([carrier isEqualToString:@""]) {
|
|
|
+//
|
|
|
+// if (lift_gate_integer == 1) {
|
|
|
+// lift_gate = @"true";
|
|
|
+// } else {
|
|
|
+// lift_gate = @"false";
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
int common_carrier_check = 0;
|
|
|
if (logist && [logist isEqualToString:@"COMMON CARRIER"]) {
|
|
|
|
|
|
common_carrier_check = 1;
|
|
|
[params setValue:lift_gate forKey:@"lift_gate"];
|
|
|
+#ifdef BUILD_CONTRAST
|
|
|
+ [params setValue:carrier forKey:@"carrier"];
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
+ // NSString *Sql = [NSString stringWithFormat: @"select carrier from offline_contact where contact_id = %d;",contact_id];
|
|
|
+ // NSString * code = [iSalesDB jk_queryText:Sql];
|
|
|
+
|
|
|
+// [self offline_getCarrierCode:offline_getCarrierCode];
|
|
|
+
|
|
|
+ NSDictionary *carrierDic = [self offline_OrderCarrier:params[@"orderCode"] db:db];
|
|
|
+
|
|
|
NSDictionary *val_1 = @{
|
|
|
@"check" : [NSNumber numberWithInteger:common_carrier_check],
|
|
|
@"sub_item" : @{
|
|
|
- @"count" : [NSNumber numberWithInteger:1],
|
|
|
@"item_0" : @{
|
|
|
@"aname" : @"Do you have Loading Dock Available ? Slide to green for YES",
|
|
|
@"control" : @"switch",
|
|
|
@@ -11560,7 +11801,23 @@ if(stockUom==0)
|
|
|
@"refresh" : [NSNumber numberWithInteger:1],
|
|
|
@"required" : @"true",
|
|
|
@"value" : lift_gate
|
|
|
+ },
|
|
|
+#ifdef BUILD_CONTRAST
|
|
|
+ @"count" : [NSNumber numberWithInteger:2],
|
|
|
+ @"item_1" : @{
|
|
|
+ @"aname" : @"Carrier",
|
|
|
+ @"cadedate" :carrierDic,
|
|
|
+ @"control" : @"enum",
|
|
|
+ @"name" : @"carrier",
|
|
|
+ @"required" : @"false",
|
|
|
+ @"value" : @"",
|
|
|
+ @"single_select" : @"true"
|
|
|
}
|
|
|
+#else
|
|
|
+ @"count" : [NSNumber numberWithInteger:1]
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
@"value" : @"COMMON CARRIER",
|
|
|
@"value_id" : @"COMMON CARRIER"
|
|
|
@@ -11781,14 +12038,14 @@ if(stockUom==0)
|
|
|
@"keyboard" : @"int",
|
|
|
@"length" : @"16",
|
|
|
@"name" : @"credit_card_number",
|
|
|
- @"required" : @"true",
|
|
|
+ @"required" : @"false",
|
|
|
@"value" : cardNumber
|
|
|
},
|
|
|
@"item_1" : @{
|
|
|
@"aname" : @"Expiration Date",
|
|
|
@"control" : @"monthpicker",
|
|
|
@"name" : @"credit_card_expiration",
|
|
|
- @"required" : @"true",
|
|
|
+ @"required" : @"false",
|
|
|
@"type" : @"date",
|
|
|
@"value" : [month isEqualToString:@""] || [year isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"%@/%@",month,year]
|
|
|
},
|
|
|
@@ -11798,7 +12055,7 @@ if(stockUom==0)
|
|
|
@"keyboard" : @"int",
|
|
|
@"length" : @"4",
|
|
|
@"name" : @"credit_card_security_code",
|
|
|
- @"required" : @"true",
|
|
|
+ @"required" : @"false",
|
|
|
@"value" : securityCode
|
|
|
},
|
|
|
|
|
|
@@ -12981,16 +13238,21 @@ if(stockUom==0)
|
|
|
}
|
|
|
|
|
|
// NSString *sync_data = [AESCrypt fastencrypt:[RAUtils dict2string:param]];
|
|
|
+ NSString* carrier = [self offline_getCarrier:[param[@"carrier"] intValue]];
|
|
|
+
|
|
|
+ NSString* scarrier = [NSString stringWithFormat:@"carrier = '%@',",carrier];
|
|
|
|
|
|
NSString *sync_sql = @"";
|
|
|
if (submit) {
|
|
|
+ param[@"truck_carrier"]=carrier;
|
|
|
NSString *sales_rep = [iSalesDB jk_queryText:[NSString stringWithFormat:@"select sales_rep from offline_order where so_id = '%@';",so_id]];
|
|
|
[param setValue:sales_rep forKey:@"sales_rep"];
|
|
|
NSString *sync_data = [self translateSingleQuote:[RAConvertor dict2string:param]];
|
|
|
sync_sql = [NSString stringWithFormat:@",sync_data = '%@' ",sync_data];
|
|
|
}
|
|
|
+
|
|
|
|
|
|
- NSString *orderSql = [NSString stringWithFormat:@"update offline_order set %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ so_id = '%@' %@ where so_id = '%@';",schedule_date, order_status,general_notes,internal_notes,poNumber,must_call,sign_picpath,total_price,paymentsAndCredits,handling_fee_placeholder,lift_gate,lift_gate_placeholder,logist,logistic_note,erpOrderStatus,paymentType,credit_card_address1,credit_card_address2,credit_card_city,credit_card_first_name,credit_card_last_name,credit_card_number,credit_card_security_code,credit_card_state,credit_card_type,credit_card_zipcode,credit_card_expiration_year,credit_card_expiration_month,customer_cid,customer_contact,customer_email,customer_phone,customer_fax,receive_cid,receive_name,receive_ext,receive_contact,receive_phone,receive_email,receive_fax,sender_cid,sender_name,sender_ext,sender_contact,sender_phone,sender_fax,sender_email,shipping_billto_cid,shipping_billto_name,shipping_billto_ext,shipping_billto_contact,shipping_billto_phone,shipping_billto_fax,shipping_billto_email,billing_cid,billing_name,billing_ext,billing_contact,billing_phone,billing_fax,billing_email,returnto_cid,returnto_name,returnto_ext,returnto_contact,returnto_phone,returnto_fax,returnto_email,so_id,sync_sql,so_id];
|
|
|
+ NSString *orderSql = [NSString stringWithFormat:@"update offline_order set %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ so_id = '%@' %@ where so_id = '%@';",schedule_date, order_status,general_notes,internal_notes,poNumber,must_call,sign_picpath,total_price,paymentsAndCredits,handling_fee_placeholder,lift_gate,lift_gate_placeholder,logist,logistic_note,erpOrderStatus,paymentType,credit_card_address1,credit_card_address2,credit_card_city,credit_card_first_name,credit_card_last_name,credit_card_number,credit_card_security_code,credit_card_state,credit_card_type,credit_card_zipcode,credit_card_expiration_year,credit_card_expiration_month,customer_cid,customer_contact,customer_email,customer_phone,customer_fax,receive_cid,receive_name,receive_ext,receive_contact,receive_phone,receive_email,receive_fax,sender_cid,sender_name,sender_ext,sender_contact,sender_phone,sender_fax,sender_email,shipping_billto_cid,shipping_billto_name,shipping_billto_ext,shipping_billto_contact,shipping_billto_phone,shipping_billto_fax,shipping_billto_email,billing_cid,billing_name,billing_ext,billing_contact,billing_phone,billing_fax,billing_email,returnto_cid,returnto_name,returnto_ext,returnto_contact,returnto_phone,returnto_fax,returnto_email,scarrier,so_id,sync_sql,so_id];
|
|
|
|
|
|
DebugLog(@"save order contactSql: %@",contactSql);
|
|
|
DebugLog(@"save order orderSql: %@",orderSql);
|
|
|
@@ -16602,11 +16864,28 @@ if(stockUom==0)
|
|
|
|
|
|
}];
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // default carrier
|
|
|
+ NSString *carrier_sql = [NSString stringWithFormat:@"select name from carrier where code_id = (select carrier from offline_contact where contact_id = '%@');",customer_cid];
|
|
|
+
|
|
|
+ __block NSString *carrier = @"";
|
|
|
+
|
|
|
+ [iSalesDB jk_query:carrier_sql db:db close:NO completion:^(sqlite3_stmt *statment, NSMutableDictionary *container, long *count) {
|
|
|
+
|
|
|
+ carrier = [self textAtColumn:0 statement:statment];
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
NSString* so_id = [self get_offline_soid:db];
|
|
|
if(so_id==nil)
|
|
|
so_id=[NSString stringWithFormat:@"OFFLINE%@",[NSUUID UUID].UUIDString ];
|
|
|
|
|
|
- NSString* sql_neworder=[NSString stringWithFormat:@"insert into offline_order(so_id,status,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,sales_rep,create_by,customer_contact,must_call,sender_cid,sender_name,sender_ext,sender_contact,sender_phone,sender_fax,sender_email,billing_cid,billing_name,billing_ext,billing_contact,billing_phone,billing_fax,billing_email,sales_terms) values('%@',0,'%@','%@','%@','%@','%@','%@','%@','%@',1,'%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','FOB')",so_id,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,customer_sales_rep,create_by ,contact_name,cid,name,ext,contact,phone,fax,email,customer_cid,customer_name,customer_contact_ext,customer_contact,customer_phone,customer_fax,customer_email];
|
|
|
+ NSString* sql_neworder=[NSString stringWithFormat:@"insert into offline_order(so_id,status,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,sales_rep,create_by,customer_contact,must_call,sender_cid,sender_name,sender_ext,sender_contact,sender_phone,sender_fax,sender_email,billing_cid,billing_name,billing_ext,billing_contact,billing_phone,billing_fax,billing_email,sales_terms,carrier) values('%@',0,'%@','%@','%@','%@','%@','%@','%@','%@',1,'%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','FOB','%@')",so_id,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,customer_sales_rep,create_by ,contact_name,cid,name,ext,contact,phone,fax,email,customer_cid,customer_name,customer_contact_ext,customer_contact,customer_phone,customer_fax,customer_email,carrier];
|
|
|
|
|
|
|
|
|
|
|
|
@@ -16801,6 +17080,7 @@ if(stockUom==0)
|
|
|
double weight=[bsubtotaljson[@"weight"] doubleValue];
|
|
|
int carton=[bsubtotaljson[@"carton"] intValue];
|
|
|
cart_count+=[bsubtotaljson[@"items"] allKeys].count;
|
|
|
+ int mpack =[bsubtotaljson[@"mpack"] intValue];
|
|
|
|
|
|
// itemjson[@"img_url"]= [self model_category_img:[NSString stringWithFormat:@"%@",[NSNumber numberWithInt:item_id]] model_name:nil db:db];
|
|
|
// NSDate *img_date = [NSDate date];
|
|
|
@@ -16820,6 +17100,7 @@ if(stockUom==0)
|
|
|
itemjson[@"discount"]=[NSNumber numberWithInt:discount];
|
|
|
itemjson[@"description"]=[NSString stringWithFormat:@"%@\n%@",nsname,nsdescription ];
|
|
|
itemjson[@"stockUom"]=[NSNumber numberWithInt:stockUom];
|
|
|
+ itemjson[@"mpack"]=[NSNumber numberWithInt:mpack];
|
|
|
itemjson[@"note"]=nsline_note;
|
|
|
if (!can_create_backorder) {
|
|
|
itemjson[@"is_out_of_stock"] = [NSNumber numberWithBool:availability >= item_count ? NO : YES];
|