|
@@ -1268,152 +1268,6 @@
|
|
|
return [RAUtils dict2data:ret];
|
|
return [RAUtils dict2data:ret];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-+(NSData*) offline_orderlist :(NSMutableDictionary *) params
|
|
|
|
|
-{
|
|
|
|
|
- NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- int limit = [[params valueForKey:@"limit"] intValue];
|
|
|
|
|
- int offset = [[params valueForKey:@"offset"] intValue];
|
|
|
|
|
- NSString* keyword = [params valueForKey:@"keyWord"];
|
|
|
|
|
-
|
|
|
|
|
- NSString* where=@"1=1";
|
|
|
|
|
- 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,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;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- int count=0;
|
|
|
|
|
- while (sqlite3_step(statement) == SQLITE_ROW)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- NSMutableDictionary* item=[[NSMutableDictionary alloc]init];
|
|
|
|
|
-
|
|
|
|
|
- int order_id = sqlite3_column_double(statement, 0);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- char *soid = (char*)sqlite3_column_text(statement, 1);
|
|
|
|
|
- if(soid==nil)
|
|
|
|
|
- soid= "";
|
|
|
|
|
- NSString *nssoid= [[NSString alloc]initWithUTF8String:soid];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- int status = sqlite3_column_double(statement, 2);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- char *sales_rep = (char*)sqlite3_column_text(statement, 3);
|
|
|
|
|
- if(sales_rep==nil)
|
|
|
|
|
- sales_rep= "";
|
|
|
|
|
- NSString *nssales_rep= [[NSString alloc]initWithUTF8String:sales_rep];
|
|
|
|
|
-
|
|
|
|
|
- char *create_by = (char*)sqlite3_column_text(statement, 4);
|
|
|
|
|
- if(create_by==nil)
|
|
|
|
|
- create_by= "";
|
|
|
|
|
- NSString *nscreate_by= [[NSString alloc]initWithUTF8String:create_by];
|
|
|
|
|
-
|
|
|
|
|
- char *company_name = (char*)sqlite3_column_text(statement, 5);
|
|
|
|
|
- if(company_name==nil)
|
|
|
|
|
- company_name= "";
|
|
|
|
|
- NSString *nscompany_name= [[NSString alloc]initWithUTF8String:company_name];
|
|
|
|
|
-
|
|
|
|
|
- char *create_time = (char*)sqlite3_column_text(statement, 6);
|
|
|
|
|
- if(create_time==nil)
|
|
|
|
|
- create_time= "";
|
|
|
|
|
- NSString *nscreate_time= [[NSString alloc]initWithUTF8String:create_time];
|
|
|
|
|
-
|
|
|
|
|
- double total_price = sqlite3_column_double(statement, 7);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- NSString* nsstatus=@"";
|
|
|
|
|
- switch (status) {
|
|
|
|
|
- case 0:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Temp Order";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 1:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Saved Order";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 10:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Quote Submitted";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 11:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Sales Order Submitted";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 12:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Processing";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 13:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Shipped";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 14:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Closed";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case 15:
|
|
|
|
|
- {
|
|
|
|
|
- nsstatus=@"Cancelled";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- default:
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- item[@"sales_rep"]= nssales_rep;
|
|
|
|
|
- item[@"orderStatus"]= [NSString stringWithFormat:@"%d",status];
|
|
|
|
|
- item[@"order_status"]= nsstatus;
|
|
|
|
|
- item[@"so#"]= nssoid;
|
|
|
|
|
- item[@"price"]= [NSString stringWithFormat:@"$%.2f",total_price];
|
|
|
|
|
- item[@"create_by"]= nscreate_by;
|
|
|
|
|
- item[@"customer_name"]= nscompany_name;
|
|
|
|
|
- item[@"order_id"]= [NSString stringWithFormat:@"%d",order_id];
|
|
|
|
|
- item[@"order_code"]= nssoid;//[NSString stringWithFormat:@"%d",order_id];
|
|
|
|
|
- item[@"purchase_time"]= nscreate_time;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- ret[[NSString stringWithFormat:@"item_%d",count]]= item;
|
|
|
|
|
- count++;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- ret[@"count"]= [NSNumber numberWithInt:count];
|
|
|
|
|
- //ret[@"total_count"]= [NSNumber numberWithInt:count];
|
|
|
|
|
- // ret[@"wish_count"]= [NSNumber numberWithInt:count];
|
|
|
|
|
- ret[@"result"]= [NSNumber numberWithInt:2];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- sqlite3_finalize(statement);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
|
|
-
|
|
|
|
|
- return [RAUtils dict2data:ret];
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
+(NSData*) offline_editorder :(NSMutableDictionary *) params
|
|
+(NSData*) offline_editorder :(NSMutableDictionary *) params
|
|
|
{
|
|
{
|
|
@@ -2342,6 +2196,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Jack
|
|
#pragma mark - Jack
|
|
|
|
|
+#warning 做SQL操作时转义!!
|
|
|
|
|
|
|
|
+ (NSDictionary *)offline_getAllCountryDefault:(NSString *)countryCode {
|
|
+ (NSDictionary *)offline_getAllCountryDefault:(NSString *)countryCode {
|
|
|
// "val_227" : {
|
|
// "val_227" : {
|
|
@@ -2715,6 +2570,7 @@
|
|
|
if (!text) {
|
|
if (!text) {
|
|
|
text = @"";
|
|
text = @"";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return text;
|
|
return text;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4233,21 +4089,33 @@
|
|
|
|
|
|
|
|
#pragma mark order detail
|
|
#pragma mark order detail
|
|
|
|
|
|
|
|
|
|
++ (NSString *)replaceHtml:(NSString *)html String:(NSString *)str0 withString:(NSString *)str1 {
|
|
|
|
|
+ if (str1.length == 0) {
|
|
|
|
|
+ str1 = @" ";
|
|
|
|
|
+ }
|
|
|
|
|
+ NSString *str = [html stringByReplacingOccurrencesOfString:str0 withString:str1];
|
|
|
|
|
+ return str;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
+(NSData*) offline_orderdetail :(NSMutableDictionary *) params
|
|
+(NSData*) offline_orderdetail :(NSMutableDictionary *) params
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
DebugLog(@"offline oderdetail params: %@",params);
|
|
DebugLog(@"offline oderdetail params: %@",params);
|
|
|
|
|
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
|
|
|
|
int orderId = [params[@"orderId"] intValue];
|
|
int orderId = [params[@"orderId"] intValue];
|
|
|
NSMutableDictionary* ret = [self dictionaryFileName:@"orderDetail.json"];
|
|
NSMutableDictionary* ret = [self dictionaryFileName:@"orderDetail.json"];
|
|
|
|
|
|
|
|
- NSString* sql=[NSString stringWithFormat:@"select o._id,o.so_id,o.poNumber,o.create_time,o.status,o.TotalCuft,o.TotalWeight,o.TotalCarton,decrypt(c.company_name),o.customer_contact,decrypt(c.addr_1),c.addr_2,c.addr_3,c.addr_4,o.logist,o.shipping,o.lift_gate_value,o.general_notes,o.internal_notes,o.paymentType,o.lift_gate,o.receive_name,o.receive_contact,o.receive_ext,o.sender_name,o.sender_contact,o.sender_ext,o.shipping_billto_name,o.shipping_billto_contact,o.shipping_billto_ext,o.billing_name,o.billing_contact,o.billing_ext,o.returnto_name,o.returnto_contact,o.returnto_ext,o.handling_fee_value,o.paymentsAndCredits,o.totalPrice,o.customer_cid from (select _id,so_id,poNumber,create_time,status,TotalCuft,TotalWeight,TotalCarton,customer_cid,customer_contact,logist,shipping,lift_gate_value,general_notes,internal_notes,paymentType,lift_gate,receive_name,receive_contact,receive_ext,sender_name,sender_contact,sender_ext,shipping_billto_name,shipping_billto_contact,shipping_billto_ext,billing_name,billing_contact,billing_ext,returnto_name,returnto_contact,returnto_ext,handling_fee_value,paymentsAndCredits,totalPrice,customer_cid from offline_order where _id=%d) o left join offline_contact c on o.customer_cid=c.contact_id",orderId ];
|
|
|
|
|
|
|
+ NSString* sql=[NSString stringWithFormat:@"select o._id,o.so_id,o.poNumber,o.create_time,o.status,o.TotalCuft,o.TotalWeight,o.TotalCarton,decrypt(c.company_name),o.customer_contact,decrypt(c.addr_1),c.addr_2,c.addr_3,c.addr_4,o.logist,o.shipping,o.lift_gate_value,o.general_notes,o.internal_notes,o.paymentType,o.lift_gate,o.receive_name,o.receive_contact,o.receive_ext,o.sender_name,o.sender_contact,o.sender_ext,o.shipping_billto_name,o.shipping_billto_contact,o.shipping_billto_ext,o.billing_name,o.billing_contact,o.billing_ext,o.returnto_name,o.returnto_contact,o.returnto_ext,o.handling_fee_value,o.paymentsAndCredits,o.totalPrice,o.customer_cid,o.credit_card_first_name,o.credit_card_last_name,o.credit_card_address1,o.credit_card_address2,o.credit_card_zipcode,o.credit_card_type,o.credit_card_number,o.credit_card_security_code,o.credit_card_expiration,o.credit_card_city,o.credit_card_state from (select _id,so_id,poNumber,create_time,status,TotalCuft,TotalWeight,TotalCarton,customer_cid,customer_contact,logist,shipping,lift_gate_value,general_notes,internal_notes,paymentType,lift_gate,receive_name,receive_contact,receive_ext,sender_name,sender_contact,sender_ext,shipping_billto_name,shipping_billto_contact,shipping_billto_ext,billing_name,billing_contact,billing_ext,returnto_name,returnto_contact,returnto_ext,handling_fee_value,paymentsAndCredits,totalPrice,customer_cid,credit_card_first_name,credit_card_last_name,credit_card_address1,credit_card_address2,credit_card_zipcode,credit_card_type,credit_card_number,credit_card_security_code,credit_card_expiration,credit_card_city,credit_card_state from offline_order where _id=%d) o left join offline_contact c on o.customer_cid=c.contact_id",orderId ];
|
|
|
|
|
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
sqlite3_stmt * statement;
|
|
sqlite3_stmt * statement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSString *customerID = nil; // 在查询结果中还需要调用offline_contactinfo,需要使用,其中要打开db 就会lock,故而将其置于外面,在close db后在调用
|
|
|
|
|
+
|
|
|
if (sqlite3_prepare_v2(db, [sql UTF8String], -1, &statement, nil) == SQLITE_OK)
|
|
if (sqlite3_prepare_v2(db, [sql UTF8String], -1, &statement, nil) == SQLITE_OK)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -4412,88 +4280,128 @@
|
|
|
|
|
|
|
|
// order info
|
|
// order info
|
|
|
NSError *error = nil;
|
|
NSError *error = nil;
|
|
|
- NSString* orderinfo = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"orderinfo" ofType:@"template"] encoding:NSUTF8StringEncoding error:&error];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"SO_PLACEHOLDER" withString:nssoid];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"PO_PLACEHOLDER" withString:nspoNumber];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"ORDERDATE_PLACEHOLDER" withString:nscreate_time];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"ORDERSTATUS_PLACEHOLDER" withString:nsstatus];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"CUFT_PLACEHOLDER" withString:[NSString stringWithFormat:@"%.2f",TotalCuft]];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"WEIGHT_PLACEHOLDER" withString:[NSString stringWithFormat:@"%.2f",TotalWeight]];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"CARTON_PLACEHOLDER" withString:[NSString stringWithFormat:@"%.2f",TotalCarton]];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"COMPANY_PLACEHOLDER" withString:nscompany_name];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"CONTACT_PLACEHOLDER" withString:nscustomer_contact];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"ADDRESS_PLACEHOLDER" withString:customer_address];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"SHIPPINGMETHOD_PLACEHOLDER" withString:nslogist];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"SHIPPING_PLACEHOLDER" withString:[NSString stringWithFormat:@"%.2f",shipping]];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"LIFTGATE_PLACEHOLDER" withString:[NSString stringWithFormat:@"%.2f",lift_gate]];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"GENERALNOTES_PLACEHOLDER" withString:nsgeneral_notes];
|
|
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"INTERNALNOTES_PLACEHOLDER" withString:nsinternal_notes];
|
|
|
|
|
|
|
+// NSString* orderinfo = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"orderinfo" ofType:@"template"] encoding:NSUTF8StringEncoding error:&error];
|
|
|
|
|
+ NSString* orderinfo = [self textFileName:@"order_info.html"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ orderinfo = [self replaceHtml:orderinfo String:@"SO_or_nbsp" withString:nssoid];
|
|
|
|
|
+ orderinfo = [self replaceHtml:orderinfo String:@"PO_or_nbsp" withString:nspoNumber];
|
|
|
|
|
+ orderinfo = [self replaceHtml:orderinfo String:@"OrderDate_or_nbsp" withString:nscreate_time];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"OrderStatus_or_nbsp" withString:nsstatus];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"TotalCuft_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",TotalCuft]];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"TotalWeight_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",TotalWeight]];
|
|
|
|
|
+ orderinfo = [self replaceHtml:orderinfo String:@"TotalCarton_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",TotalCarton]];
|
|
|
|
|
+ orderinfo =[self replaceHtml:orderinfo String:@"CustomerInfo_or_nbsp" withString:nscompany_name];
|
|
|
|
|
+ orderinfo =[self replaceHtml:orderinfo String:@"CustomerName_or_nbsp" withString:nscustomer_contact];
|
|
|
|
|
+ orderinfo =[self replaceHtml:orderinfo String:@"CustomerAddress_or_nbsp" withString:customer_address];
|
|
|
|
|
+ orderinfo =[self replaceHtml:orderinfo String:@"ShippingMethod_or_nbsp" withString:nslogist];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"Shipping_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",shipping]];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"LiftgateFee_or_nbsp" withString:[NSString stringWithFormat:@"%.2f",lift_gate]];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"GeneralNotes_or_nbsp" withString:nsgeneral_notes];
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"InternalNotes_or_nbsp" withString:nsinternal_notes];
|
|
|
|
|
|
|
|
NSString *payment = nil;
|
|
NSString *payment = nil;
|
|
|
if([nspayment_type isEqualToString:@"Credit Card"])
|
|
if([nspayment_type isEqualToString:@"Credit Card"])
|
|
|
{
|
|
{
|
|
|
- payment=[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"creditcardpayment" ofType:@"template"] encoding:NSUTF8StringEncoding error:&error];
|
|
|
|
|
- //payment=[payment stringByReplacingOccurrencesOfString:@"PAYMENTTYPE_PLACEHOLDER" withString:nspayment_type];
|
|
|
|
|
|
|
+ payment = [self textFileName:@"creditcardpayment.html"];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *card_first_name = [self textAtColumn:40 statement:statement];
|
|
|
|
|
+ NSString *card_last_name = [self textAtColumn:41 statement:statement];
|
|
|
|
|
+ NSString *card_addr1 = [self textAtColumn:42 statement:statement];
|
|
|
|
|
+ NSString *card_addr2 = [self textAtColumn:43 statement:statement];
|
|
|
|
|
+ NSString *card_zipcode = [self textAtColumn:44 statement:statement];
|
|
|
|
|
+ NSString *card_type = [self textAtColumn:45 statement:statement];
|
|
|
|
|
+ if (card_type.length > 0) { // 显示星号
|
|
|
|
|
+ card_type = @"****";
|
|
|
|
|
+ }
|
|
|
|
|
+ NSString *card_number = [self textAtColumn:46 statement:statement]; // 只显示最后四位
|
|
|
|
|
+ if (card_number.length > 0 && card_number.length > 4) {
|
|
|
|
|
+ for (int i = 0; i < card_number.length - 4; i++) {
|
|
|
|
|
+ card_number = [card_number stringByReplacingCharactersInRange:NSMakeRange(i, 1) withString:@"*"];
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ card_number = @"";
|
|
|
|
|
+ }
|
|
|
|
|
+ NSString *card_security_code = [self textAtColumn:47 statement:statement];
|
|
|
|
|
+ NSString *card_expiration = [self textAtColumn:48 statement:statement];
|
|
|
|
|
+ if (card_expiration.length > 0) { // 显示星号
|
|
|
|
|
+ card_expiration = @"****";
|
|
|
|
|
+ }
|
|
|
|
|
+ NSString *card_city = [self textAtColumn:49 statement:statement];
|
|
|
|
|
+ NSString *card_state = [self textAtColumn:50 statement:statement];
|
|
|
|
|
+
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"CardNumber_or_nbsp" withString:card_number];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"CardType_or_nbsp" withString:card_type];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"CardExpireDate_or_nbsp" withString:card_expiration];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingFirstName_or_nbsp" withString:card_first_name];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingLastName_or_nbsp" withString:card_last_name];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingAddr1_or_nbsp" withString:card_addr1];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingAddr2_or_nbsp" withString:card_addr2];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingCity_or_nbsp" withString:card_city];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingState_or_nbsp" withString:card_state];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"BillingZipCode_or_nbsp" withString:card_zipcode];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- payment=[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"normalpayment" ofType:@"template"] encoding:NSUTF8StringEncoding error:&error];
|
|
|
|
|
- payment=[payment stringByReplacingOccurrencesOfString:@"PAYMENTTYPE_PLACEHOLDER" withString:nspayment_type];
|
|
|
|
|
|
|
+ payment=[self textFileName:@"normalpayment.html"];
|
|
|
|
|
+ payment = [self replaceHtml:payment String:@"PAYMENTTYPE_PLACEHOLDER" withString:nspayment_type];
|
|
|
}
|
|
}
|
|
|
- orderinfo=[orderinfo stringByReplacingOccurrencesOfString:@"PAYMENT_PLACEHOLDER" withString:payment];
|
|
|
|
|
|
|
+ orderinfo=[self replaceHtml:orderinfo String:@"Payment_info_or_nbsp" withString:payment];
|
|
|
ret[@"order_info"]= orderinfo;
|
|
ret[@"order_info"]= orderinfo;
|
|
|
ret[@"result"]= [NSNumber numberWithInt:2];
|
|
ret[@"result"]= [NSNumber numberWithInt:2];
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// more info
|
|
// more info
|
|
|
NSString *moreInfo = [self textFileName:@"more_info.html"];
|
|
NSString *moreInfo = [self textFileName:@"more_info.html"];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/*****ship to******/
|
|
/*****ship to******/
|
|
|
// ShipToCompany_or_ 
|
|
// ShipToCompany_or_ 
|
|
|
NSString *shipToCompany = [self textAtColumn:21 statement:statement];
|
|
NSString *shipToCompany = [self textAtColumn:21 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ShipToCompany_or_ " withString:shipToCompany];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ShipToCompany_or_" withString:shipToCompany];
|
|
|
NSString *shipToName = [self textAtColumn:22 statement:statement];
|
|
NSString *shipToName = [self textAtColumn:22 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ShipToName_or_ " withString:shipToName];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ShipToName_or_" withString:shipToName];
|
|
|
NSString *shipToAddr = [self textAtColumn:23 statement:statement];
|
|
NSString *shipToAddr = [self textAtColumn:23 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ShipToAddress_or_ " withString:shipToAddr];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ShipToAddress_or_" withString:shipToAddr];
|
|
|
|
|
|
|
|
/*****ship from******/
|
|
/*****ship from******/
|
|
|
// ShipFromCompany_or_ 
|
|
// ShipFromCompany_or_ 
|
|
|
NSString *shipFromCompany = [self textAtColumn:24 statement:statement];
|
|
NSString *shipFromCompany = [self textAtColumn:24 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ShipFromCompany_or_ " withString:shipFromCompany];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ShipFromCompany_or_" withString:shipFromCompany];
|
|
|
NSString *shipFromName = [self textAtColumn:25 statement:statement];
|
|
NSString *shipFromName = [self textAtColumn:25 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ShipFromName_or_ " withString:shipFromName];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ShipFromName_or_" withString:shipFromName];
|
|
|
NSString *shipFromAddr = [self textAtColumn:26 statement:statement];
|
|
NSString *shipFromAddr = [self textAtColumn:26 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ShipFromAddress_or_ " withString:shipFromAddr];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ShipFromAddress_or_" withString:shipFromAddr];
|
|
|
|
|
|
|
|
/*****freight to******/
|
|
/*****freight to******/
|
|
|
// FreightBillToCompany_or_ 
|
|
// FreightBillToCompany_or_ 
|
|
|
NSString *freightBillToCompany = [self textAtColumn:27 statement:statement];
|
|
NSString *freightBillToCompany = [self textAtColumn:27 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"FreightBillToCompany_or_ " withString:freightBillToCompany];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"FreightBillToCompany_or_" withString:freightBillToCompany];
|
|
|
NSString *freightBillToName = [self textAtColumn:28 statement:statement];
|
|
NSString *freightBillToName = [self textAtColumn:28 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"FreightBillToName_or_ " withString:freightBillToName];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"FreightBillToName_or_" withString:freightBillToName];
|
|
|
NSString *freightBillToAddr = [self textAtColumn:29 statement:statement];
|
|
NSString *freightBillToAddr = [self textAtColumn:29 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"FreightBillToAddress_or_ " withString:freightBillToAddr];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"FreightBillToAddress_or_" withString:freightBillToAddr];
|
|
|
|
|
|
|
|
/*****merchandise to******/
|
|
/*****merchandise to******/
|
|
|
// MerchandiseBillToCompany_or_ 
|
|
// MerchandiseBillToCompany_or_ 
|
|
|
NSString *merchandiseBillToCompany = [self textAtColumn:30 statement:statement];
|
|
NSString *merchandiseBillToCompany = [self textAtColumn:30 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"MerchandiseBillToCompany_or_ " withString:merchandiseBillToCompany];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"MerchandiseBillToCompany_or_" withString:merchandiseBillToCompany];
|
|
|
NSString *merchandiseBillToName = [self textAtColumn:31 statement:statement];
|
|
NSString *merchandiseBillToName = [self textAtColumn:31 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"MerchandiseBillToName_or_ " withString:merchandiseBillToName];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"MerchandiseBillToName_or_" withString:merchandiseBillToName];
|
|
|
NSString *merchandiseBillToAddr = [self textAtColumn:32 statement:statement];
|
|
NSString *merchandiseBillToAddr = [self textAtColumn:32 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"MerchandiseBillToAddress_or_ " withString:merchandiseBillToAddr];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"MerchandiseBillToAddress_or_" withString:merchandiseBillToAddr];
|
|
|
|
|
|
|
|
/*****return to******/
|
|
/*****return to******/
|
|
|
// ReturnToCompany_or_ 
|
|
// ReturnToCompany_or_ 
|
|
|
NSString *returnToCompany = [self textAtColumn:33 statement:statement];
|
|
NSString *returnToCompany = [self textAtColumn:33 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ReturnToCompany_or_ " withString:returnToCompany];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ReturnToCompany_or_" withString:returnToCompany];
|
|
|
NSString *returnToName = [self textAtColumn:34 statement:statement];
|
|
NSString *returnToName = [self textAtColumn:34 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ReturnToName_or_ " withString:returnToName];
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ReturnToName_or_" withString:returnToName];
|
|
|
NSString *returnToAddr = [self textAtColumn:35 statement:statement];
|
|
NSString *returnToAddr = [self textAtColumn:35 statement:statement];
|
|
|
- moreInfo = [moreInfo stringByReplacingOccurrencesOfString:@"ReturnToAddress_or_ " withString:returnToAddr];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ moreInfo = [self replaceHtml:moreInfo String:@"ReturnToAddress_or_" withString:returnToAddr];
|
|
|
|
|
+//
|
|
|
ret[@"more_order_info"] = moreInfo;
|
|
ret[@"more_order_info"] = moreInfo;
|
|
|
|
|
+ DebugLog(@"more info : %@",moreInfo);
|
|
|
|
|
|
|
|
// handling fee
|
|
// handling fee
|
|
|
double handlingFee = sqlite3_column_double(statement, 36);
|
|
double handlingFee = sqlite3_column_double(statement, 36);
|
|
@@ -4508,34 +4416,14 @@
|
|
|
ret[@"Total"] = [NSString stringWithFormat:@"$%.2f",totalPrice];
|
|
ret[@"Total"] = [NSString stringWithFormat:@"$%.2f",totalPrice];
|
|
|
|
|
|
|
|
// customer info
|
|
// customer info
|
|
|
- NSString *customerID = [self textAtColumn:39 statement:statement];
|
|
|
|
|
- NSDictionary *contactInfo = [self offline_contactinfo:[@{@"contactId":customerID} mutableCopy]];
|
|
|
|
|
-// NSMutableDictionary *customerInfo = [NSMutableDictionary dictionary];
|
|
|
|
|
-
|
|
|
|
|
-// customerInfo[@"business_card_0"] = contactInfo[@"business_card_0"];
|
|
|
|
|
-// customerInfo[@"business_card_1"] = contactInfo[@"business_card_1"];
|
|
|
|
|
-// customerInfo[@"business_card_2"] = contactInfo[@"business_card_2"];
|
|
|
|
|
-// customerInfo[@"customer_address1"] = contactInfo[@"customer_address1"];
|
|
|
|
|
-// customerInfo[@"customer_address2"] = contactInfo[@"customer_address2"];
|
|
|
|
|
-// customerInfo[@"customer_address3"] = contactInfo[@"customer_address3"];
|
|
|
|
|
-// customerInfo[@"customer_address4"] = contactInfo[@"customer_address4"];
|
|
|
|
|
-// customerInfo[@"customer_cid"] = contactInfo[@"customer_cid"];
|
|
|
|
|
-// customerInfo[@"customer_city"] = contactInfo[@"customer_city"];
|
|
|
|
|
-// customerInfo[@"customer_contact"] = contactInfo[@"customer_contact"];
|
|
|
|
|
-// customerInfo[@"customer_contact_notes"] = contactInfo[@"customer_contact_notes"];
|
|
|
|
|
-// customerInfo[@"customer_country"] = contactInfo[@"customer_country"];
|
|
|
|
|
-// customerInfo[@"customer_email"] = contactInfo[@"customer_email"];
|
|
|
|
|
-// customerInfo[@"customer_fax"] = contactInfo[@"customer_fax"];
|
|
|
|
|
-// customerInfo[@"customer_first_name"] = contactInfo[@"customer_first_name"];
|
|
|
|
|
-// customerInfo[@"customer_last_name"] = contactInfo[@"customer_last_name"];
|
|
|
|
|
-// customerInfo[@"customer_name"] = contactInfo[@"customer_name"];
|
|
|
|
|
-// customerInfo[@"customer_phone"] = contactInfo[@"customer_phone"];
|
|
|
|
|
-// customerInfo[@"customer_price_type"] = contactInfo[@"customer_price_type"];
|
|
|
|
|
-// customerInfo[@"customer_sales_rep"] = contactInfo[@"customer_sales_rep"];
|
|
|
|
|
-// customerInfo[@"customer_state"] = contactInfo[@"customer_state"];
|
|
|
|
|
-// customerInfo[@"customer_zipcode"] = contactInfo[@"customer_zipcode"];
|
|
|
|
|
-
|
|
|
|
|
- ret[@"customerInfo"] = contactInfo;
|
|
|
|
|
|
|
+ customerID = [self textAtColumn:39 statement:statement];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // mode
|
|
|
|
|
+ ret[@"mode"] = appDelegate.mode;
|
|
|
|
|
+
|
|
|
|
|
+ // model_count
|
|
|
|
|
+ ret[@"model_count"] = @(0);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4552,11 +4440,229 @@
|
|
|
|
|
|
|
|
[iSalesDB close_db:db];
|
|
[iSalesDB close_db:db];
|
|
|
|
|
|
|
|
|
|
+ NSDictionary *contactInfo = [self offline_contactinfo:[@{@"contactId":customerID} mutableCopy]];
|
|
|
|
|
+ // NSMutableDictionary *customerInfo = [NSMutableDictionary dictionary];
|
|
|
|
|
+
|
|
|
|
|
+ // customerInfo[@"business_card_0"] = contactInfo[@"business_card_0"];
|
|
|
|
|
+ // customerInfo[@"business_card_1"] = contactInfo[@"business_card_1"];
|
|
|
|
|
+ // customerInfo[@"business_card_2"] = contactInfo[@"business_card_2"];
|
|
|
|
|
+ // customerInfo[@"customer_address1"] = contactInfo[@"customer_address1"];
|
|
|
|
|
+ // customerInfo[@"customer_address2"] = contactInfo[@"customer_address2"];
|
|
|
|
|
+ // customerInfo[@"customer_address3"] = contactInfo[@"customer_address3"];
|
|
|
|
|
+ // customerInfo[@"customer_address4"] = contactInfo[@"customer_address4"];
|
|
|
|
|
+ // customerInfo[@"customer_cid"] = contactInfo[@"customer_cid"];
|
|
|
|
|
+ // customerInfo[@"customer_city"] = contactInfo[@"customer_city"];
|
|
|
|
|
+ // customerInfo[@"customer_contact"] = contactInfo[@"customer_contact"];
|
|
|
|
|
+ // customerInfo[@"customer_contact_notes"] = contactInfo[@"customer_contact_notes"];
|
|
|
|
|
+ // customerInfo[@"customer_country"] = contactInfo[@"customer_country"];
|
|
|
|
|
+ // customerInfo[@"customer_email"] = contactInfo[@"customer_email"];
|
|
|
|
|
+ // customerInfo[@"customer_fax"] = contactInfo[@"customer_fax"];
|
|
|
|
|
+ // customerInfo[@"customer_first_name"] = contactInfo[@"customer_first_name"];
|
|
|
|
|
+ // customerInfo[@"customer_last_name"] = contactInfo[@"customer_last_name"];
|
|
|
|
|
+ // customerInfo[@"customer_name"] = contactInfo[@"customer_name"];
|
|
|
|
|
+ // customerInfo[@"customer_phone"] = contactInfo[@"customer_phone"];
|
|
|
|
|
+ // customerInfo[@"customer_price_type"] = contactInfo[@"customer_price_type"];
|
|
|
|
|
+ // customerInfo[@"customer_sales_rep"] = contactInfo[@"customer_sales_rep"];
|
|
|
|
|
+ // customerInfo[@"customer_state"] = contactInfo[@"customer_state"];
|
|
|
|
|
+ // customerInfo[@"customer_zipcode"] = contactInfo[@"customer_zipcode"];
|
|
|
|
|
+
|
|
|
|
|
+ ret[@"customerInfo"] = contactInfo;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
return [RAUtils dict2data:ret];
|
|
return [RAUtils dict2data:ret];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#pragma mark order list
|
|
|
|
|
+
|
|
|
|
|
++(NSData*) offline_orderlist :(NSMutableDictionary *) params
|
|
|
|
|
+{
|
|
|
|
|
+ NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ int limit = [[params valueForKey:@"limit"] intValue];
|
|
|
|
|
+ int offset = [[params valueForKey:@"offset"] intValue];
|
|
|
|
|
+ NSString* keyword = [params valueForKey:@"keyWord"];
|
|
|
|
|
+ keyword = [self translateSingleQuote:keyword]; // 转义单引号
|
|
|
|
|
+ NSString *orderStatus = [params valueForKey:@"orderStatus"];
|
|
|
|
|
+
|
|
|
|
|
+ NSString* where=@"1 = 1";
|
|
|
|
|
+ if(keyword.length>0)
|
|
|
|
|
+ where=[where stringByAppendingString:[NSString stringWithFormat:@" and (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]];
|
|
|
|
|
+
|
|
|
|
|
+ if (orderStatus.length > 0) {
|
|
|
|
|
+ NSArray *order_status_array = [orderStatus componentsSeparatedByString:@","];
|
|
|
|
|
+ if (order_status_array.count == 1) {
|
|
|
|
|
+ where = [where stringByAppendingString:[NSString stringWithFormat:@" and o.status = %@",[order_status_array firstObject]]];
|
|
|
|
|
+ } else if (order_status_array.count > 1) {
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < order_status_array.count;i++) {
|
|
|
|
|
+ NSString *status = order_status_array[i];
|
|
|
|
|
+ NSString *condition = @" or";
|
|
|
|
|
+ if (i == 0) {
|
|
|
|
|
+ condition = @" and (";
|
|
|
|
|
+ }
|
|
|
|
|
+ where = [where stringByAppendingString:[NSString stringWithFormat:@"%@ o.status = %@",condition,status]];
|
|
|
|
|
+ }
|
|
|
|
|
+ where = [where stringByAppendingString:@" )"];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ 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,o.customer_contact 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];
|
|
|
|
|
+
|
|
|
|
|
+ DebugLog(@"order list sql: %@",sqlQuery);
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
+ sqlite3_stmt * statement;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ int count=0;
|
|
|
|
|
+ while (sqlite3_step(statement) == SQLITE_ROW)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableDictionary* item=[[NSMutableDictionary alloc]init];
|
|
|
|
|
+
|
|
|
|
|
+ int order_id = sqlite3_column_double(statement, 0);
|
|
|
|
|
+
|
|
|
|
|
+ char *soid = (char*)sqlite3_column_text(statement, 1);
|
|
|
|
|
+ if(soid==nil)
|
|
|
|
|
+ soid= "";
|
|
|
|
|
+ NSString *nssoid= [[NSString alloc]initWithUTF8String:soid];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ int status = sqlite3_column_double(statement, 2);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ char *sales_rep = (char*)sqlite3_column_text(statement, 3);
|
|
|
|
|
+ if(sales_rep==nil)
|
|
|
|
|
+ sales_rep= "";
|
|
|
|
|
+ NSString *nssales_rep= [[NSString alloc]initWithUTF8String:sales_rep];
|
|
|
|
|
+
|
|
|
|
|
+ char *create_by = (char*)sqlite3_column_text(statement, 4);
|
|
|
|
|
+ if(create_by==nil)
|
|
|
|
|
+ create_by= "";
|
|
|
|
|
+ NSString *nscreate_by= [[NSString alloc]initWithUTF8String:create_by];
|
|
|
|
|
+
|
|
|
|
|
+ char *company_name = (char*)sqlite3_column_text(statement, 5);
|
|
|
|
|
+ if(company_name==nil)
|
|
|
|
|
+ company_name= "";
|
|
|
|
|
+ NSString *nscompany_name= [[NSString alloc]initWithUTF8String:company_name];
|
|
|
|
|
+
|
|
|
|
|
+ char *create_time = (char*)sqlite3_column_text(statement, 6);
|
|
|
|
|
+ if(create_time==nil)
|
|
|
|
|
+ create_time= "";
|
|
|
|
|
+ NSString *nscreate_time= [[NSString alloc]initWithUTF8String:create_time];
|
|
|
|
|
+
|
|
|
|
|
+ double total_price = sqlite3_column_double(statement, 7);
|
|
|
|
|
+
|
|
|
|
|
+ NSString *customer_contact = [self textAtColumn:8 statement:statement];
|
|
|
|
|
+
|
|
|
|
|
+ NSString* nsstatus=@"";
|
|
|
|
|
+ switch (status) {
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Temp Order";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Saved Order";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 10:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Quote Submitted";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 11:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Sales Order Submitted";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 12:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Processing";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 13:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Shipped";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 14:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Closed";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case 15:
|
|
|
|
|
+ {
|
|
|
|
|
+ nsstatus=@"Cancelled";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ // ": "JH",
|
|
|
|
|
+ // "": "$8307.00",
|
|
|
|
|
+ // "": "MOB1608050001",
|
|
|
|
|
+ // "": "ArpithaT",
|
|
|
|
|
+ // "": "1st Stage Property Transformations",
|
|
|
|
|
+ // "": "JANICE SUTTON",
|
|
|
|
|
+ // "": 2255,
|
|
|
|
|
+ // "": "08/02/2016 09:49:18",
|
|
|
|
|
+ // "": 1,
|
|
|
|
|
+ // "": "Saved Order"
|
|
|
|
|
+ // "": "1470384050483",
|
|
|
|
|
+ // "model_count": "6 / 28"
|
|
|
|
|
+
|
|
|
|
|
+ item[@"sales_rep"]= nssales_rep;
|
|
|
|
|
+ item[@"price"]= [NSString stringWithFormat:@"$%.2f",total_price];
|
|
|
|
|
+ item[@"so#"]= nssoid;
|
|
|
|
|
+ item[@"create_by"]= nscreate_by;
|
|
|
|
|
+ item[@"customer_name"]= nscompany_name;
|
|
|
|
|
+ item[@"customer_contact"] = customer_contact;
|
|
|
|
|
+ item[@"order_id"]= [NSString stringWithFormat:@"%d",order_id];
|
|
|
|
|
+ item[@"purchase_time"]= nscreate_time;
|
|
|
|
|
+ item[@"orderStatus"]= [NSString stringWithFormat:@"%d",status];
|
|
|
|
|
+ item[@"order_status"]= nsstatus;
|
|
|
|
|
+ item[@"order_code"]= nssoid;//[NSString stringWithFormat:@"%d",order_id];
|
|
|
|
|
+ // item[@"model_count"]
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ ret[[NSString stringWithFormat:@"item_%d",count]]= item;
|
|
|
|
|
+ count++;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ret[@"count"]= [NSNumber numberWithInt:count];
|
|
|
|
|
+ //ret[@"total_count"]= [NSNumber numberWithInt:count];
|
|
|
|
|
+ // ret[@"wish_count"]= [NSNumber numberWithInt:count];
|
|
|
|
|
+ ret[@"result"]= [NSNumber numberWithInt:2];
|
|
|
|
|
+ ret[@"can_see_price"] = [NSNumber numberWithBool:YES];
|
|
|
|
|
+ ret[@"time_zone"] = @"PST";
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3_finalize(statement);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int total_count = [iSalesDB get_recordcount:db table:@"offline_order o left join offline_contact c on o.customer_cid=c.contact_id" where:where];
|
|
|
|
|
+
|
|
|
|
|
+ ret[@"total_count"] = [NSNumber numberWithInteger:total_count];
|
|
|
|
|
+
|
|
|
|
|
+ [iSalesDB close_db:db];
|
|
|
|
|
+
|
|
|
|
|
+ return [RAUtils dict2data:ret];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|