|
|
@@ -1225,6 +1225,43 @@
|
|
|
{
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
+ NSString* customer_cid = [self translateSingleQuote:params[@"customer_cid"]];
|
|
|
+// NSString* customer_address1 = [self translateSingleQuote:params[@"customer_address1"]];
|
|
|
+// NSString* customer_address2 = [self translateSingleQuote:params[@"customer_address2"]];
|
|
|
+// NSString* customer_address3 = [self translateSingleQuote:params[@"customer_address3"]];
|
|
|
+// NSString* customer_address4 = [self translateSingleQuote:params[@"customer_address4"]];
|
|
|
+// NSString* customer_city = [self translateSingleQuote:params[@"customer_city"]];
|
|
|
+ NSString* customer_contact = [self translateSingleQuote:params[@"customer_contact"]];
|
|
|
+// NSString* customer_contact_ext = [self translateSingleQuote:params[@"customer_contact_ext"]];
|
|
|
+// NSString* customer_contact_notes = [self translateSingleQuote:params[@"customer_contact_notes"]];
|
|
|
+// NSString* customer_country = [self translateSingleQuote:params[@"customer_country"]];
|
|
|
+ NSString* customer_email = [self translateSingleQuote:params[@"customer_email"]];
|
|
|
+ NSString* customer_fax = [self translateSingleQuote:params[@"customer_fax"]];
|
|
|
+ NSString* customer_first_name = [self translateSingleQuote:params[@"customer_first_name"]];
|
|
|
+ NSString* customer_last_name = [self translateSingleQuote:params[@"customer_last_name"]];
|
|
|
+// NSString* customer_name = [self translateSingleQuote:params[@"customer_name"]];
|
|
|
+ NSString* customer_phone = [self translateSingleQuote:params[@"customer_phone"]];
|
|
|
+ // NSString* customer_price_type = [self translateSingleQuote:params[@"customer_price_type"]];
|
|
|
+ NSString* customer_sales_rep = [self translateSingleQuote:params[@"customer_sales_rep"]];
|
|
|
+ // NSString* customer_state = [self translateSingleQuote:params[@"customer_state"]];
|
|
|
+ // NSString* customer_zipcode = [self translateSingleQuote:params[@"customer_zipcode"]];
|
|
|
+ NSString* create_by = [self translateSingleQuote:params[@"user"]];
|
|
|
+
|
|
|
+ NSMutableArray* arr_name= [[NSMutableArray alloc] init];
|
|
|
+
|
|
|
+ [arr_name addObject:customer_first_name];
|
|
|
+ [arr_name addObject:customer_last_name];
|
|
|
+
|
|
|
+ NSString *contact_name=[RAUtils arr2string:arr_name separator:@" " trim:true];
|
|
|
+
|
|
|
+
|
|
|
+ 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) values('OFFLINE'||hex(randomblob(16)),-1,'%@','%@','%@','%@','%@','%@','%@','%@')",customer_cid,customer_contact,customer_email,customer_fax,customer_phone,customer_sales_rep,create_by ,contact_name];
|
|
|
+
|
|
|
+ int result =[iSalesDB execSql:sql_neworder ];
|
|
|
+ [ret setValue:[NSNumber numberWithInt:result] forKey:@"result"];
|
|
|
+
|
|
|
+ //insert into offline_order(so_id,status,contact_id,sales_rep,create_by,customer_contact) select 'OFFLINE'||hex(randomblob(16)),-1,contact_id,sales_rep,company_name from offline_contact where contact_id='99FURO0002'
|
|
|
+
|
|
|
return [RAUtils dict2data:ret];
|
|
|
|
|
|
}
|
|
|
@@ -1238,9 +1275,9 @@
|
|
|
NSString* keyword = [params valueForKey:@"keyWord"];
|
|
|
|
|
|
NSString* where=@"1=1";
|
|
|
- if(keyword!=nil)
|
|
|
+ if(keyword.length>0)
|
|
|
where=[NSString stringWithFormat:@"lower(o.order_id) like '%%%@%%' or lower(c.company_name) like '%%%@%%' or lower(c.company_name) like '%%%@%%' or lower(o.create_by) like '%%%@%%'",keyword.lowercaseString,keyword.lowercaseString,keyword.lowercaseString,keyword.lowercaseString];
|
|
|
- NSString* sqlQuery=[NSString stringWithFormat:@"SELECT o._id,o.so_id,o.status,o.sales_rep,o.create_by,c.company_name,o.create_time,o.total_price from offline_order o left join offline_contact c on o.contact_id=c.contact_idr where %@ order by create_time limit %d offset %d" ,where, limit, offset];
|
|
|
+ NSString* sqlQuery=[NSString stringWithFormat:@"SELECT o._id,o.so_id,o.status,o.sales_rep,o.create_by,decrypt(c.company_name),o.create_time,o.total_price from offline_order o left join offline_contact c on o.customer_cid=c.contact_id where %@ order by o.create_time limit %d offset %d" ,where, limit, offset];
|
|
|
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
sqlite3_stmt * statement;
|