|
|
@@ -4131,6 +4131,20 @@
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
++ (NSString *)changeDateTime:(NSString *)dateTime Formate:(NSString *)formate withFormate:(NSString *)newFormate {
|
|
|
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
|
|
+ formatter.dateFormat = formate;
|
|
|
+
|
|
|
+ NSDate *date = [formatter dateFromString:dateTime];
|
|
|
+
|
|
|
+ formatter.dateFormat = newFormate;
|
|
|
+ return [formatter stringFromDate:date];
|
|
|
+}
|
|
|
+
|
|
|
++ (NSString *)changeDateTime:(NSString *)dateTime {
|
|
|
+ return [self changeDateTime:dateTime Formate:@"YYYY-MM-DD HH:mm:ss" withFormate:@"MM/DD/YYYY HH:mm:ss"];
|
|
|
+}
|
|
|
+
|
|
|
+(NSData*) offline_orderdetail :(NSMutableDictionary *) params
|
|
|
{
|
|
|
|
|
|
@@ -4141,7 +4155,7 @@
|
|
|
int orderId = [params[@"orderId"] intValue];
|
|
|
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,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 ];
|
|
|
+ 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.total_price,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,o.shipNull 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,total_price,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,ifnull(shipping,'ship_null') as shipNull 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_stmt * statement;
|
|
|
@@ -4182,6 +4196,7 @@
|
|
|
if(create_time==nil)
|
|
|
create_time= "";
|
|
|
NSString *nscreate_time= [[NSString alloc]initWithUTF8String:create_time];
|
|
|
+ nscreate_time = [self changeDateTime:nscreate_time];// 与在线统一
|
|
|
|
|
|
int status = sqlite3_column_int(statement, 4);
|
|
|
NSString* nsstatus=@"";
|
|
|
@@ -4289,8 +4304,14 @@
|
|
|
logist= "";
|
|
|
NSString *nslogist=[[NSString alloc]initWithUTF8String:logist];
|
|
|
|
|
|
- double shipping = sqlite3_column_double(statement, 15);
|
|
|
+ NSString *shipping = [NSString stringWithFormat:@"$%.2f",sqlite3_column_double(statement, 15)];
|
|
|
+ if ([[self textAtColumn:51 statement:statement] isEqualToString:@"ship_null"]) {
|
|
|
+ shipping = @"Shipping To Be Quoted";
|
|
|
+ }
|
|
|
|
|
|
+ // Shipping
|
|
|
+ ret[@"Shipping"] = shipping;
|
|
|
+
|
|
|
double lift_gate = sqlite3_column_double(statement, 16);
|
|
|
// Liftgate Fee(No loading dock)
|
|
|
ret[@"Liftgate Fee(No loading dock)"] = [NSString stringWithFormat:@"$%.2f",lift_gate];
|
|
|
@@ -4313,8 +4334,6 @@
|
|
|
int have_lift_gate = sqlite3_column_int(statement, 20);
|
|
|
|
|
|
// order info
|
|
|
- NSError *error = nil;
|
|
|
-// NSString* orderinfo = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"orderinfo" ofType:@"template"] encoding:NSUTF8StringEncoding error:&error];
|
|
|
NSString* orderinfo = [self textFileName:@"order_info.html"];
|
|
|
|
|
|
|
|
|
@@ -4329,7 +4348,7 @@
|
|
|
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:@"Shipping_or_nbsp" withString: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];
|
|
|
@@ -4591,6 +4610,7 @@
|
|
|
if(create_time==nil)
|
|
|
create_time= "";
|
|
|
NSString *nscreate_time= [[NSString alloc]initWithUTF8String:create_time];
|
|
|
+ nscreate_time = [self changeDateTime:nscreate_time]; // 与在线统一
|
|
|
|
|
|
double total_price = sqlite3_column_double(statement, 7);
|
|
|
|