|
@@ -41,6 +41,38 @@
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation OrderDetailViewController
|
|
@implementation OrderDetailViewController
|
|
|
|
|
+
|
|
|
|
|
+- (void)saleOrderWithPath:(NSString *)path {
|
|
|
|
|
+
|
|
|
|
|
+ PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
|
|
|
|
|
+
|
|
|
|
|
+ ViewController.url = path;
|
|
|
|
|
+ ViewController.canSave = false;
|
|
|
|
|
+ ViewController.isLocalfile=YES;
|
|
|
|
|
+ NSString* subject;
|
|
|
|
|
+
|
|
|
|
|
+ NSString* cur_time =[RAUtils current_date];
|
|
|
|
|
+ subject =@"Sales Order";
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+ NSString* customer_email= [appDelegate.customerInfo valueForKey:@"customer_email"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableArray* send_to = [[NSMutableArray alloc]init];
|
|
|
|
|
+ if(customer_email.length>0)
|
|
|
|
|
+ {
|
|
|
|
|
+ send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ ViewController.mail_to = send_to;
|
|
|
|
|
+
|
|
|
|
|
+ ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
|
|
|
|
|
+ ViewController.mail_subject = subject;
|
|
|
|
|
+
|
|
|
|
|
+ ViewController.hidenavi = false;
|
|
|
|
|
+ [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
-(void) reload_container_getdata:(bool) update_data
|
|
-(void) reload_container_getdata:(bool) update_data
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -301,7 +333,7 @@
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- (void)onDownloadOrderClick:(id)sender {
|
|
- (void)onDownloadOrderClick:(id)sender {
|
|
|
-
|
|
|
|
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
|
|
|
PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
|
|
PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
|
|
@@ -363,7 +395,18 @@
|
|
|
@"thumb" : @"1",
|
|
@"thumb" : @"1",
|
|
|
@"order_code" : self.order_code,
|
|
@"order_code" : self.order_code,
|
|
|
} mutableCopy];
|
|
} mutableCopy];
|
|
|
- [OLDataProvider offline_request_salesorder:params];
|
|
|
|
|
|
|
+ NSData *dicData = [OLDataProvider offline_request_salesorder:params];
|
|
|
|
|
+ NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
|
|
|
|
|
+ if ([dic[@"result"] integerValue] == RESULT_TRUE) {
|
|
|
|
|
+ NSString *path = dic[@"pdf_path"];
|
|
|
|
|
+ [weakself saleOrderWithPath:path];
|
|
|
|
|
+// ViewController.url = path;
|
|
|
|
|
+// ViewController.isLocalfile = YES;
|
|
|
|
|
+//
|
|
|
|
|
+// [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [RAUtils message_alert:@"Sales Order Open Failed" title:@"Message" controller:weakself];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -395,7 +438,20 @@
|
|
|
@"thumb" : @"0",
|
|
@"thumb" : @"0",
|
|
|
@"order_code" : self.order_code,
|
|
@"order_code" : self.order_code,
|
|
|
} mutableCopy];
|
|
} mutableCopy];
|
|
|
- [OLDataProvider offline_request_salesorder:params];
|
|
|
|
|
|
|
+ NSData *dicData = [OLDataProvider offline_request_salesorder:params];
|
|
|
|
|
+ NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
|
|
|
|
|
+ if ([dic[@"result"] integerValue] == RESULT_TRUE) {
|
|
|
|
|
+ NSString *path = dic[@"pdf_path"];
|
|
|
|
|
+ [weakself saleOrderWithPath:path];
|
|
|
|
|
+// ViewController.url = path;
|
|
|
|
|
+// ViewController.isLocalfile = YES;
|
|
|
|
|
+//
|
|
|
|
|
+// [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ [RAUtils message_alert:@"Sales Order Open Failed" title:@"Message" controller:weakself];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|