|
|
@@ -1671,100 +1671,100 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-+(void) uploadFile:(NSString*) file
|
|
|
-{
|
|
|
- NSData* data = [NSData dataWithContentsOfFile: file];
|
|
|
- UIApplication * app = [UIApplication sharedApplication];
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
-
|
|
|
-
|
|
|
- AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
-
|
|
|
- if(appDelegate.user!=nil)
|
|
|
- [params setValue:appDelegate.user forKey:@"user"];
|
|
|
- // if(appDelegate.contact_id!=nil)
|
|
|
- // [params setValue:appDelegate.contact_id forKey:@"contactId"];
|
|
|
- if(appDelegate.password!=nil)
|
|
|
- [params setValue:appDelegate.password forKey:@"password"];
|
|
|
-
|
|
|
-
|
|
|
- NSMutableURLRequest *request = [serializer multipartFormRequestWithMethod:@"POST" URLString:URL_UPLOAD_OFFLINE parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
|
|
|
- [formData appendPartWithFileData:data name:@"upfile" fileName:[file lastPathComponent] mimeType:@"application/zip"];
|
|
|
- } error:nil];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
|
|
|
-
|
|
|
- NSProgress *progress = nil;
|
|
|
-
|
|
|
- NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (error) {
|
|
|
-
|
|
|
- NSString* err_msg = [error localizedDescription];
|
|
|
- DebugLog(@"%@",err_msg);// [self.view updateWithMessage:[NSString stringWithFormat:@"Error : %@!", error.debugDescription]];
|
|
|
-
|
|
|
-
|
|
|
- NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
-
|
|
|
- DebugLog(@"data string: %@",str);
|
|
|
- [RAUtils message_alert:@"Can not connect to server please try again." title:@"Upload Image" controller:self] ;
|
|
|
-
|
|
|
- } else {
|
|
|
- DebugLog(@"response ");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- NSData *data = [NSJSONSerialization dataWithJSONObject:(NSDictionary*)responseObject options:kNilOptions error:nil];
|
|
|
-
|
|
|
- // 再将NSData转为字符串
|
|
|
- NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
|
-
|
|
|
- // NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
-
|
|
|
- DebugLog(@"data string: %@",jsonStr);
|
|
|
-
|
|
|
- NSDictionary* json = responseObject;
|
|
|
-
|
|
|
-
|
|
|
- if([[json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
-// NSString* img_url_down = json[@"img_url_aname"];
|
|
|
-// NSString* img_url_up = json[@"img_url"];
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload file" controller:nil] ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- // [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
- }];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // [self.uploadProgress setProgressWithUploadProgressOfTask:uploadTask animated:true];
|
|
|
- //
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- [uploadTask resume];
|
|
|
-
|
|
|
-}
|
|
|
+//+(void) uploadFile:(NSString*) file
|
|
|
+//{
|
|
|
+// NSData* data = [NSData dataWithContentsOfFile: file];
|
|
|
+// UIApplication * app = [UIApplication sharedApplication];
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
+//
|
|
|
+//
|
|
|
+// AFHTTPRequestSerializer* serializer=[AFHTTPRequestSerializer serializer] ;
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
+//
|
|
|
+// if(appDelegate.user!=nil)
|
|
|
+// [params setValue:appDelegate.user forKey:@"user"];
|
|
|
+// // if(appDelegate.contact_id!=nil)
|
|
|
+// // [params setValue:appDelegate.contact_id forKey:@"contactId"];
|
|
|
+// if(appDelegate.password!=nil)
|
|
|
+// [params setValue:appDelegate.password forKey:@"password"];
|
|
|
+//
|
|
|
+//
|
|
|
+// NSMutableURLRequest *request = [serializer multipartFormRequestWithMethod:@"POST" URLString:URL_UPLOAD_OFFLINE parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
|
|
|
+// [formData appendPartWithFileData:data name:@"upfile" fileName:[file lastPathComponent] mimeType:@"application/zip"];
|
|
|
+// } error:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
|
|
|
+//
|
|
|
+// NSProgress *progress = nil;
|
|
|
+//
|
|
|
+// NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if (error) {
|
|
|
+//
|
|
|
+// NSString* err_msg = [error localizedDescription];
|
|
|
+// DebugLog(@"%@",err_msg);// [self.view updateWithMessage:[NSString stringWithFormat:@"Error : %@!", error.debugDescription]];
|
|
|
+//
|
|
|
+//
|
|
|
+// NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
+//
|
|
|
+// DebugLog(@"data string: %@",str);
|
|
|
+// [RAUtils message_alert:@"Can not connect to server please try again." title:@"Upload Image" controller:self] ;
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// DebugLog(@"response ");
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// NSData *data = [NSJSONSerialization dataWithJSONObject:(NSDictionary*)responseObject options:kNilOptions error:nil];
|
|
|
+//
|
|
|
+// // 再将NSData转为字符串
|
|
|
+// NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
|
+//
|
|
|
+// // NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
+//
|
|
|
+// DebugLog(@"data string: %@",jsonStr);
|
|
|
+//
|
|
|
+// NSDictionary* json = responseObject;
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//// NSString* img_url_down = json[@"img_url_aname"];
|
|
|
+//// NSString* img_url_up = json[@"img_url"];
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload file" controller:nil] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// // [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+// }];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// // [self.uploadProgress setProgressWithUploadProgressOfTask:uploadTask animated:true];
|
|
|
+// //
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// [uploadTask resume];
|
|
|
+//
|
|
|
+//}
|
|
|
+(NSDictionary *) prepareUpload:(NSArray*) arr_order
|
|
|
{
|
|
|
NSString* serial= [[NSUUID UUID] UUIDString];
|
|
|
@@ -1966,7 +1966,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
|
|
|
|
|
|
|
|
|
- NSString *sqlQuery = [ NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id",orderCode ];
|
|
|
+ NSString *sqlQuery = [ NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id,o.customer_cid from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id,so_no from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id left join offline_order as o on c.so_no = o.so_id;",orderCode ];
|
|
|
|
|
|
|
|
|
// NSString *sqlQuery = [ NSString stringWithFormat:@"select c.product_id,decrypt(c.str_price),c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from offline_cart c left join product m on c.product_id=m.product_id where c.so_no='%@'",orderCode ];
|
|
|
@@ -1992,7 +1992,8 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
|
|
|
NSMutableDictionary* itemjson = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
-
|
|
|
+ char *customer_cid = (char *)sqlite3_column_text(statement, 10);
|
|
|
+ NSString *customerID = [NSString stringWithUTF8String:customer_cid];
|
|
|
|
|
|
|
|
|
int product_id = sqlite3_column_int(statement, 0);
|
|
|
@@ -2005,7 +2006,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
if(str_price==nil)
|
|
|
{
|
|
|
// NSNumber* price= [self get_model_default_price:appDelegate.contact_id product_id:product_id db:db];
|
|
|
- NSNumber* price = [self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db];
|
|
|
+ NSNumber* price = [self get_model_default_price:customerID product_id:nil item_id:@(item_id) db:db];
|
|
|
if(price==nil)
|
|
|
Price=@"No Price.";
|
|
|
else
|