|
@@ -7280,24 +7280,60 @@
|
|
|
+ (NSDictionary *)shippingMethodDic:(NSDictionary *)params db:(sqlite3 *)db {
|
|
+ (NSDictionary *)shippingMethodDic:(NSDictionary *)params db:(sqlite3 *)db {
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
|
|
|
|
-// refresh_trigger logist
|
|
|
|
|
- NSString *refresh_trigger = [self valueInParams:params key:@"refresh_trigger"];
|
|
|
|
|
|
|
+ NSString *orderCode = [self valueInParams:params key:@"orderCode"];
|
|
|
|
|
+ orderCode = [self translateSingleQuote:orderCode];
|
|
|
|
|
|
|
|
- NSString *logist = nil;
|
|
|
|
|
- if ([refresh_trigger isEqualToString:@"logist"]) {
|
|
|
|
|
- logist = [self valueInParams:params key:@"logist"];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select logist,lift_gate,logistic_note from offline_order where so_id = '%@';",orderCode];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ __block NSString *logist = nil;
|
|
|
|
|
+ __block NSString *lift_gate = nil;
|
|
|
|
|
+ __block int lift_gate_integer = 0;
|
|
|
|
|
+ __block NSString *logistic_note = nil;
|
|
|
|
|
+ [iSalesDB jk_query:sql db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
+
|
|
|
|
|
+ logist = [self textAtColumn:0 statement:stmt];
|
|
|
|
|
+
|
|
|
|
|
+ lift_gate_integer = sqlite3_column_int(stmt, 1);
|
|
|
|
|
+
|
|
|
|
|
+ logistic_note = [self textAtColumn:2 statement:stmt];
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
[dic setValue:[NSNumber numberWithInteger:1] forKey:@"count"];
|
|
[dic setValue:[NSNumber numberWithInteger:1] forKey:@"count"];
|
|
|
[dic setValue:@"Shipping Method" forKey:@"title"];
|
|
[dic setValue:@"Shipping Method" forKey:@"title"];
|
|
|
|
|
|
|
|
// val_0
|
|
// val_0
|
|
|
|
|
+ int PERSONAL_PICK_UP_check = 0;
|
|
|
|
|
+ int USE_MY_CARRIER_check = 0;
|
|
|
|
|
+ NSString *logistic_note_text = @"";
|
|
|
|
|
+ int will_call_check = 0;
|
|
|
if (logist && [logist isEqualToString:@"WILL CALL"]) {
|
|
if (logist && [logist isEqualToString:@"WILL CALL"]) {
|
|
|
|
|
|
|
|
|
|
+ will_call_check = 1;
|
|
|
|
|
+
|
|
|
|
|
+ if ([logistic_note containsString:@"PERSONAL PICK UP"]) {
|
|
|
|
|
+
|
|
|
|
|
+ PERSONAL_PICK_UP_check = 1;
|
|
|
|
|
+
|
|
|
|
|
+ } else if ([logistic_note containsString:@"USE MY CARRIER"]) {
|
|
|
|
|
+
|
|
|
|
|
+ USE_MY_CARRIER_check = 1;
|
|
|
|
|
+ NSArray *logistic_note_array = [logistic_note componentsSeparatedByString:@"\n\t"];
|
|
|
|
|
+ logistic_note = [logistic_note_array firstObject];
|
|
|
|
|
+ if (logistic_note_array.count > 1) {
|
|
|
|
|
+ logistic_note_text = [logistic_note_array lastObject];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
NSMutableDictionary *val_0 = [NSMutableDictionary dictionary];
|
|
NSMutableDictionary *val_0 = [NSMutableDictionary dictionary];
|
|
|
- [val_0 setValue:[NSNumber numberWithInteger:0] forKey:@"check"];
|
|
|
|
|
|
|
+ [val_0 setValue:[NSNumber numberWithInteger:will_call_check] forKey:@"check"];
|
|
|
[val_0 setValue:@"WILL CALL(requires 24 hours advance notice)" forKey:@"value"];
|
|
[val_0 setValue:@"WILL CALL(requires 24 hours advance notice)" forKey:@"value"];
|
|
|
[val_0 setValue:@"WILL CALL" forKey:@"value_id"];
|
|
[val_0 setValue:@"WILL CALL" forKey:@"value_id"];
|
|
|
|
|
|
|
@@ -7308,13 +7344,13 @@
|
|
|
@"cadedate" : @{
|
|
@"cadedate" : @{
|
|
|
@"count" : [NSNumber numberWithInteger:2],
|
|
@"count" : [NSNumber numberWithInteger:2],
|
|
|
@"val_0" : @{
|
|
@"val_0" : @{
|
|
|
- @"check" : [NSNumber numberWithInteger:0],
|
|
|
|
|
|
|
+ @"check" : [NSNumber numberWithInteger:PERSONAL_PICK_UP_check],
|
|
|
@"refresh" : [NSNumber numberWithInteger:0],
|
|
@"refresh" : [NSNumber numberWithInteger:0],
|
|
|
@"value" : @"PERSONAL PICK UP",
|
|
@"value" : @"PERSONAL PICK UP",
|
|
|
@"value_id" : @"PERSONAL PICK UP"
|
|
@"value_id" : @"PERSONAL PICK UP"
|
|
|
},
|
|
},
|
|
|
@"val_1" : @{
|
|
@"val_1" : @{
|
|
|
- @"check" : [NSNumber numberWithInteger:0],
|
|
|
|
|
|
|
+ @"check" : [NSNumber numberWithInteger:USE_MY_CARRIER_check],
|
|
|
@"refresh" : [NSNumber numberWithInteger:0],
|
|
@"refresh" : [NSNumber numberWithInteger:0],
|
|
|
@"sub_item" : @{
|
|
@"sub_item" : @{
|
|
|
@"count" : [NSNumber numberWithInteger:1],
|
|
@"count" : [NSNumber numberWithInteger:1],
|
|
@@ -7325,7 +7361,7 @@
|
|
|
@"name" : @"logist_note_text",
|
|
@"name" : @"logist_note_text",
|
|
|
@"refresh" : [NSNumber numberWithInteger:0],
|
|
@"refresh" : [NSNumber numberWithInteger:0],
|
|
|
@"required" : @"false",
|
|
@"required" : @"false",
|
|
|
- @"value" : @""
|
|
|
|
|
|
|
+ @"value" : logistic_note_text
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
@"value" : @"USE MY CARRIER",
|
|
@"value" : @"USE MY CARRIER",
|
|
@@ -7343,14 +7379,22 @@
|
|
|
[val_0 setValue:val0_subItem forKey:@"sub_item"];
|
|
[val_0 setValue:val0_subItem forKey:@"sub_item"];
|
|
|
|
|
|
|
|
// val_1
|
|
// val_1
|
|
|
- NSString *lift_gate = [self valueInParams:params key:@"lift_gate"];
|
|
|
|
|
- if (lift_gate && [lift_gate isEqualToString:@"true"]) {
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (lift_gate_integer == 1) {
|
|
|
|
|
+ lift_gate = @"true";
|
|
|
} else {
|
|
} else {
|
|
|
lift_gate = @"false";
|
|
lift_gate = @"false";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ int common_carrier_check = 0;
|
|
|
|
|
+ if (logist && [logist isEqualToString:@"COMMON CARRIER"]) {
|
|
|
|
|
+
|
|
|
|
|
+ common_carrier_check = 1;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
NSDictionary *val_1 = @{
|
|
NSDictionary *val_1 = @{
|
|
|
- @"check" : [NSNumber numberWithInteger:0],
|
|
|
|
|
|
|
+ @"check" : [NSNumber numberWithInteger:common_carrier_check],
|
|
|
@"sub_item" : @{
|
|
@"sub_item" : @{
|
|
|
@"count" : [NSNumber numberWithInteger:1],
|
|
@"count" : [NSNumber numberWithInteger:1],
|
|
|
@"item_0" : @{
|
|
@"item_0" : @{
|
|
@@ -7389,6 +7433,58 @@
|
|
|
return dic;
|
|
return dic;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
++ (NSDictionary *)submitAsDic:(NSDictionary *)params db:(sqlite3 *)db {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *orderCode = [self valueInParams:params key:@"orderCode"];
|
|
|
|
|
+ orderCode = [self translateSingleQuote:orderCode];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select submit_as from offline_order where so_id = '%@';",orderCode];
|
|
|
|
|
+ __block int submit_as_integer = 0;
|
|
|
|
|
+ [iSalesDB jk_query:sql db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
+ submit_as_integer = sqlite3_column_int(stmt, 0);
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ int check11 = 0;
|
|
|
|
|
+ int check10 = 0;
|
|
|
|
|
+ if (submit_as_integer == 11) {
|
|
|
|
|
+ check11 = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (submit_as_integer == 10) {
|
|
|
|
|
+ check10 = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // section_0
|
|
|
|
|
+ NSDictionary *dic = @{
|
|
|
|
|
+ @"count" : @(1),
|
|
|
|
|
+ @"item_0" : @{
|
|
|
|
|
+ @"aname" : @"Submit Order As",
|
|
|
|
|
+ @"cadedate" : @{
|
|
|
|
|
+ @"count" : @(2),
|
|
|
|
|
+ @"val_0" : @{
|
|
|
|
|
+ @"check" : [NSNumber numberWithInteger:check11],
|
|
|
|
|
+ @"value" : @"Sales Order",
|
|
|
|
|
+ @"value_id" : @(11)
|
|
|
|
|
+ },
|
|
|
|
|
+ @"val_1" : @{
|
|
|
|
|
+ @"check" : [NSNumber numberWithInteger:check10],
|
|
|
|
|
+ @"value" : @"Quote",
|
|
|
|
|
+ @"value_id" : @(10)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ @"control" : @"enum",
|
|
|
|
|
+ @"name" : @"erpOrderStatus",
|
|
|
|
|
+ @"required" : @"true",
|
|
|
|
|
+ @"single_select" : @"true"
|
|
|
|
|
+ },
|
|
|
|
|
+ @"title" : @"Order Type"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return dic;
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
+(NSData*) offline_placeorder :(NSMutableDictionary *) params
|
|
+(NSData*) offline_placeorder :(NSMutableDictionary *) params
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -7401,6 +7497,10 @@
|
|
|
// 0 Order Type 1 Shipping Method 2 Payment Information
|
|
// 0 Order Type 1 Shipping Method 2 Payment Information
|
|
|
__block NSMutableDictionary *ret = [self dictionaryFileName:@"placeOrderTemplate.json"];
|
|
__block NSMutableDictionary *ret = [self dictionaryFileName:@"placeOrderTemplate.json"];
|
|
|
|
|
|
|
|
|
|
+ // 0 Order Type
|
|
|
|
|
+ NSDictionary *order_type_dic = [self submitAsDic:params db:db];
|
|
|
|
|
+ [ret setValue:order_type_dic forKey:@"section_0"];
|
|
|
|
|
+
|
|
|
// 1 Shipping Method
|
|
// 1 Shipping Method
|
|
|
NSDictionary *shipping_method_dic = [self shippingMethodDic:params db:db];
|
|
NSDictionary *shipping_method_dic = [self shippingMethodDic:params db:db];
|
|
|
[ret setValue:shipping_method_dic forKey:@"section_1"];
|
|
[ret setValue:shipping_method_dic forKey:@"section_1"];
|
|
@@ -7636,7 +7736,9 @@
|
|
|
|
|
|
|
|
+(NSData*) offline_saveorder :(NSMutableDictionary *) param
|
|
+(NSData*) offline_saveorder :(NSMutableDictionary *) param
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+// "logistic_note" = "PERSONAL PICK UP";
|
|
|
|
|
+ // logist_note_text
|
|
|
|
|
+ // "logistic_note" = "USE MY CARRIER";
|
|
|
NSString *so_id = [self valueInParams:param key:@"orderCode" translateSingleQuote:YES];
|
|
NSString *so_id = [self valueInParams:param key:@"orderCode" translateSingleQuote:YES];
|
|
|
NSString *general_notes = [self valueInParams:param key:@"comments" translateSingleQuote:YES];
|
|
NSString *general_notes = [self valueInParams:param key:@"comments" translateSingleQuote:YES];
|
|
|
general_notes = [general_notes isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"general_notes = '%@',",general_notes] ;
|
|
general_notes = [general_notes isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"general_notes = '%@',",general_notes] ;
|
|
@@ -7699,6 +7801,10 @@
|
|
|
NSString *logist = [self valueInParams:param key:@"logist" translateSingleQuote:YES];
|
|
NSString *logist = [self valueInParams:param key:@"logist" translateSingleQuote:YES];
|
|
|
logist = [logist isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"logist = '%@',",logist];
|
|
logist = [logist isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"logist = '%@',",logist];
|
|
|
|
|
|
|
|
|
|
+ NSString *logistic_note_text = [self valueInParams:param key:@"logist_note_text" translateSingleQuote:YES];
|
|
|
|
|
+ NSString *logistic_note = [self valueInParams:param key:@"logistic_note" translateSingleQuote:YES];
|
|
|
|
|
+ logistic_note = [logistic_note isEqualToString:@"USE MY CARRIER"] ? [NSString stringWithFormat:@"logistic_note = '%@\n\t%@',",logistic_note,logistic_note_text] : [NSString stringWithFormat:@"logistic_note = '%@',",logistic_note];
|
|
|
|
|
+
|
|
|
// NSString *erpOrderStatus = [self valueInParams:param key:@"erpOrderStatus"];
|
|
// NSString *erpOrderStatus = [self valueInParams:param key:@"erpOrderStatus"];
|
|
|
NSNumber *erpOrderStatus_number = [param objectForKey:@"erpOrderStatus"];
|
|
NSNumber *erpOrderStatus_number = [param objectForKey:@"erpOrderStatus"];
|
|
|
NSString *erpOrderStatus = erpOrderStatus_number ? @"" : [NSString stringWithFormat:@"erpOrderStatus = %@,",erpOrderStatus_number];
|
|
NSString *erpOrderStatus = erpOrderStatus_number ? @"" : [NSString stringWithFormat:@"erpOrderStatus = %@,",erpOrderStatus_number];
|
|
@@ -7923,7 +8029,7 @@
|
|
|
returnto_email = [returnto_email isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"returnto_email = '%@',",returnto_email];
|
|
returnto_email = [returnto_email isEqualToString:@""] ? @"" : [NSString stringWithFormat:@"returnto_email = '%@',",returnto_email];
|
|
|
|
|
|
|
|
|
|
|
|
|
- NSString *orderSql = [NSString stringWithFormat:@"update offline_order set %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ so_id = '%@' where so_id = '%@';",general_notes,internal_notes,poNumber,must_call,sign_picpath,total_price,paymentsAndCredits,handling_fee_placeholder,lift_gate,lift_gate_placeholder,logist,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,so_id];
|
|
|
|
|
|
|
+ NSString *orderSql = [NSString stringWithFormat:@"update offline_order set %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ so_id = '%@' where so_id = '%@';",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,so_id];
|
|
|
|
|
|
|
|
int contact_ret = [iSalesDB execSql:contactSql];
|
|
int contact_ret = [iSalesDB execSql:contactSql];
|
|
|
|
|
|