|
|
@@ -1059,50 +1059,92 @@
|
|
|
- (void)opentOrder:(void(^)(void))completionBlk {
|
|
|
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Open Order"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [RANetwork request_open_order:self.order_code completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json = result;
|
|
|
|
|
|
- NSDictionary* order_json = [RANetwork open_Order:self.order_code];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- appDelegate.order_code = self.order_code;
|
|
|
- appDelegate.order_status = self.order_status;
|
|
|
- [appDelegate SetSo:[self.content_data valueForKey:@"so#"]];
|
|
|
-
|
|
|
-
|
|
|
- appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
-
|
|
|
- appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
-
|
|
|
-// [self.navigationController popViewControllerAnimated:false];
|
|
|
-
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ appDelegate.order_code = self.order_code;
|
|
|
+ appDelegate.order_status = self.order_status;
|
|
|
+ [appDelegate SetSo:[self.content_data valueForKey:@"so#"]];
|
|
|
+
|
|
|
+
|
|
|
+ appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
+
|
|
|
+ appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
+
|
|
|
+ // [self.navigationController popViewControllerAnimated:false];
|
|
|
+
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"CartViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"CartViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
-// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
|
|
|
+ // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
|
|
|
#endif
|
|
|
-
|
|
|
- if (completionBlk) {
|
|
|
- completionBlk();
|
|
|
- }
|
|
|
-
|
|
|
-// if(self.selectOrder)
|
|
|
-// self.selectOrder(self.content_data);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ if (completionBlk) {
|
|
|
+ completionBlk();
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ // if(self.selectOrder)
|
|
|
+ // self.selectOrder(self.content_data);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* order_json = [RANetwork open_Order:self.order_code];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+// if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// appDelegate.order_code = self.order_code;
|
|
|
+// appDelegate.order_status = self.order_status;
|
|
|
+// [appDelegate SetSo:[self.content_data valueForKey:@"so#"]];
|
|
|
+//
|
|
|
+//
|
|
|
+// appDelegate.customerInfo=[[self.content_data objectForKey:@"customerInfo"] mutableCopy];
|
|
|
+//
|
|
|
+// appDelegate.contact_id=[appDelegate.customerInfo valueForKey:@"customer_cid"];
|
|
|
+//
|
|
|
+//// [self.navigationController popViewControllerAnimated:false];
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"CartViewController,ContactListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+//// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
|
|
|
+//#endif
|
|
|
+//
|
|
|
+// if (completionBlk) {
|
|
|
+// completionBlk();
|
|
|
+// }
|
|
|
+//
|
|
|
+//// if(self.selectOrder)
|
|
|
+//// self.selectOrder(self.content_data);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Open Order" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1190,76 +1232,98 @@
|
|
|
if (self.erpSerialNo) {
|
|
|
[params setValue:self.erpSerialNo forKey:@"erp_order_serial_no"];
|
|
|
}
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
+ [RANetwork request_orderdetail:params completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json = result;
|
|
|
|
|
|
- NSDictionary* order_json = [RANetwork request_OrderDetail:params];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+ [self.mum stopAnimating];
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ self.detailTable.hidden = false;
|
|
|
+ self.content_data = [order_json mutableCopy];
|
|
|
|
|
|
- [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
- [self.mum stopAnimating];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ self.content_data = nil;
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
|
|
|
{
|
|
|
- self.detailTable.hidden = false;
|
|
|
- self.content_data = [order_json mutableCopy];
|
|
|
-
|
|
|
-
|
|
|
+ self.label_net_err.hidden=false;
|
|
|
+ self.detailTable.hidden=true;
|
|
|
}
|
|
|
- else {
|
|
|
- self.content_data = nil;
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Loading Order Detail" controller:self] ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ bool web_order =[[self.content_data valueForKey:@"from_online"] boolValue];
|
|
|
+ if(web_order)
|
|
|
+ self.btnCopy.enabled = false;
|
|
|
+ else
|
|
|
+ self.btnCopy.enabled = true;
|
|
|
+ int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ int model_count =[[self.content_data valueForKey:@"model_count"] intValue];
|
|
|
+ if(model_count>0)/*&& ! appDelegate.offline_mode*/
|
|
|
+ {
|
|
|
+ if(appDelegate.user_type== USER_ROLE_EMPLOYEE || (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer))
|
|
|
+ self.btnPDF.enabled =true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // || appDelegate.user_type==USER_ROLE_CUSTOMER
|
|
|
+ if(self.is_shoporder)
|
|
|
{
|
|
|
- self.label_net_err.hidden=false;
|
|
|
- self.detailTable.hidden=true;
|
|
|
+ if(status_code==1||status_code==30)
|
|
|
+ self.btnPDF.enabled =true;
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Loading Order Detail" controller:self] ;
|
|
|
+ if(status_code==2)
|
|
|
+ self.btnPDF.enabled =true;
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ // [self.btnPDF setImage:[[UIImage imageNamed:@"download"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+
|
|
|
+ // NSString* status = [self.content_data valueForKey:@"order_status"];
|
|
|
+
|
|
|
+ NSString* lock_user = [self.content_data valueForKey:@"opened_customer"];
|
|
|
+
|
|
|
+ bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
|
|
|
+ if(status_code==1)//[status isEqualToString:@"Saved Order"])
|
|
|
+ {
|
|
|
+ // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+ //
|
|
|
+ // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
|
|
|
- bool web_order =[[self.content_data valueForKey:@"from_online"] boolValue];
|
|
|
- if(web_order)
|
|
|
- self.btnCopy.enabled = false;
|
|
|
- else
|
|
|
- self.btnCopy.enabled = true;
|
|
|
- int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- int model_count =[[self.content_data valueForKey:@"model_count"] intValue];
|
|
|
- if(model_count>0)/*&& ! appDelegate.offline_mode*/
|
|
|
+ BOOL condition = offline_edit;
|
|
|
+#ifdef OFFLINE_MODE
|
|
|
+ condition = condition || appDelegate.offline_mode==false;
|
|
|
+#else
|
|
|
+ condition = YES;
|
|
|
+#endif
|
|
|
+ if(condition)
|
|
|
{
|
|
|
- if(appDelegate.user_type== USER_ROLE_EMPLOYEE || (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer))
|
|
|
- self.btnPDF.enabled =true;
|
|
|
- else
|
|
|
- {
|
|
|
- // || appDelegate.user_type==USER_ROLE_CUSTOMER
|
|
|
- if(self.is_shoporder)
|
|
|
- {
|
|
|
- if(status_code==1||status_code==30)
|
|
|
- self.btnPDF.enabled =true;
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(status_code==2)
|
|
|
- self.btnPDF.enabled =true;
|
|
|
- }
|
|
|
- }
|
|
|
+ self.btnOpen.enabled =true;
|
|
|
+
|
|
|
+ self.btnSign.enabled = true;
|
|
|
}
|
|
|
- // [self.btnPDF setImage:[[UIImage imageNamed:@"download"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
-
|
|
|
-// NSString* status = [self.content_data valueForKey:@"order_status"];
|
|
|
-
|
|
|
- NSString* lock_user = [self.content_data valueForKey:@"opened_customer"];
|
|
|
-
|
|
|
- bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
|
|
|
- if(status_code==1)//[status isEqualToString:@"Saved Order"])
|
|
|
+ // if([lock_user isEqualToString:appDelegate.user])
|
|
|
+ // {
|
|
|
+ // self.btnCommit.enabled =true;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // self.btnCommit.enabled =false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ if(status_code==0)//[status isEqualToString:@"Quote Saved"])
|
|
|
{
|
|
|
- // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+ // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
//
|
|
|
- // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+ // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
|
|
|
BOOL condition = offline_edit;
|
|
|
#ifdef OFFLINE_MODE
|
|
|
@@ -1267,74 +1331,192 @@
|
|
|
#else
|
|
|
condition = YES;
|
|
|
#endif
|
|
|
- if(condition)
|
|
|
- {
|
|
|
- self.btnOpen.enabled =true;
|
|
|
-
|
|
|
- self.btnSign.enabled = true;
|
|
|
- }
|
|
|
- // if([lock_user isEqualToString:appDelegate.user])
|
|
|
- // {
|
|
|
- // self.btnCommit.enabled =true;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // self.btnCommit.enabled =false;
|
|
|
- }
|
|
|
- else
|
|
|
- if(status_code==0)//[status isEqualToString:@"Quote Saved"])
|
|
|
+ if (condition)
|
|
|
{
|
|
|
- // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
- //
|
|
|
- // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+ self.btnOpen.enabled =true;
|
|
|
|
|
|
- BOOL condition = offline_edit;
|
|
|
-#ifdef OFFLINE_MODE
|
|
|
- condition = condition || appDelegate.offline_mode==false;
|
|
|
-#else
|
|
|
- condition = YES;
|
|
|
-#endif
|
|
|
- if (condition)
|
|
|
- {
|
|
|
- self.btnOpen.enabled =true;
|
|
|
-
|
|
|
- self.btnSign.enabled = true;
|
|
|
- }
|
|
|
- // self.btnCommit.enabled =false;
|
|
|
+ self.btnSign.enabled = true;
|
|
|
}
|
|
|
- BOOL lock_condition_1 = [lock_user isEqualToString:appDelegate.user];
|
|
|
- BOOL lock_condition_2 = false;
|
|
|
+ // self.btnCommit.enabled =false;
|
|
|
+ }
|
|
|
+ BOOL lock_condition_1 = [lock_user isEqualToString:appDelegate.user];
|
|
|
+ BOOL lock_condition_2 = false;
|
|
|
#ifdef OFFLINE_MODE
|
|
|
- lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;
|
|
|
- lock_condition_2 = appDelegate.offline_mode && [self.order_code isEqualToString:appDelegate.order_code];
|
|
|
+ lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;
|
|
|
+ lock_condition_2 = appDelegate.offline_mode && [self.order_code isEqualToString:appDelegate.order_code];
|
|
|
#endif
|
|
|
+
|
|
|
+ if((lock_condition_1 || lock_condition_2)&& (status_code==1||status_code==0))
|
|
|
+ {
|
|
|
+ // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
|
|
|
- if((lock_condition_1 || lock_condition_2)&& (status_code==1||status_code==0))
|
|
|
- {
|
|
|
- // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
-
|
|
|
-
|
|
|
- self.btnRelease.enabled =true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
- self.btnRelease.enabled =false;
|
|
|
- }
|
|
|
|
|
|
- [self.detailTable reloadData];
|
|
|
- self.isrefreshing=false;
|
|
|
+ self.btnRelease.enabled =true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
|
|
|
- if (self.order_code == nil) {
|
|
|
- self.btnCopy.enabled = false;
|
|
|
- } else {
|
|
|
- self.btnCopy.enabled = true;
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
+ // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+ self.btnRelease.enabled =false;
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
+ [self.detailTable reloadData];
|
|
|
+ self.isrefreshing=false;
|
|
|
+
|
|
|
+ if (self.order_code == nil) {
|
|
|
+ self.btnCopy.enabled = false;
|
|
|
+ } else {
|
|
|
+ self.btnCopy.enabled = true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+//
|
|
|
+// NSDictionary* order_json = [RANetwork request_OrderDetail:params];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+// [self.mum stopAnimating];
|
|
|
+// if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// self.detailTable.hidden = false;
|
|
|
+// self.content_data = [order_json mutableCopy];
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// self.content_data = nil;
|
|
|
+// if([[order_json valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
|
|
|
+// {
|
|
|
+// self.label_net_err.hidden=false;
|
|
|
+// self.detailTable.hidden=true;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Loading Order Detail" controller:self] ;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// bool web_order =[[self.content_data valueForKey:@"from_online"] boolValue];
|
|
|
+// if(web_order)
|
|
|
+// self.btnCopy.enabled = false;
|
|
|
+// else
|
|
|
+// self.btnCopy.enabled = true;
|
|
|
+// int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// int model_count =[[self.content_data valueForKey:@"model_count"] intValue];
|
|
|
+// if(model_count>0)/*&& ! appDelegate.offline_mode*/
|
|
|
+// {
|
|
|
+// if(appDelegate.user_type== USER_ROLE_EMPLOYEE || (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeCustomer))
|
|
|
+// self.btnPDF.enabled =true;
|
|
|
+// else
|
|
|
+// {
|
|
|
+// // || appDelegate.user_type==USER_ROLE_CUSTOMER
|
|
|
+// if(self.is_shoporder)
|
|
|
+// {
|
|
|
+// if(status_code==1||status_code==30)
|
|
|
+// self.btnPDF.enabled =true;
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(status_code==2)
|
|
|
+// self.btnPDF.enabled =true;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // [self.btnPDF setImage:[[UIImage imageNamed:@"download"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+//
|
|
|
+//// NSString* status = [self.content_data valueForKey:@"order_status"];
|
|
|
+//
|
|
|
+// NSString* lock_user = [self.content_data valueForKey:@"opened_customer"];
|
|
|
+//
|
|
|
+// bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
|
|
|
+// if(status_code==1)//[status isEqualToString:@"Saved Order"])
|
|
|
+// {
|
|
|
+// // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+// //
|
|
|
+// // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+//
|
|
|
+// BOOL condition = offline_edit;
|
|
|
+//#ifdef OFFLINE_MODE
|
|
|
+// condition = condition || appDelegate.offline_mode==false;
|
|
|
+//#else
|
|
|
+// condition = YES;
|
|
|
+//#endif
|
|
|
+// if(condition)
|
|
|
+// {
|
|
|
+// self.btnOpen.enabled =true;
|
|
|
+//
|
|
|
+// self.btnSign.enabled = true;
|
|
|
+// }
|
|
|
+// // if([lock_user isEqualToString:appDelegate.user])
|
|
|
+// // {
|
|
|
+// // self.btnCommit.enabled =true;
|
|
|
+// // }
|
|
|
+// // else
|
|
|
+// // self.btnCommit.enabled =false;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// if(status_code==0)//[status isEqualToString:@"Quote Saved"])
|
|
|
+// {
|
|
|
+// // [self.btnOpen setImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+// //
|
|
|
+// // [self.btnCommit setImage:[[UIImage imageNamed:@"commit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+//
|
|
|
+// BOOL condition = offline_edit;
|
|
|
+//#ifdef OFFLINE_MODE
|
|
|
+// condition = condition || appDelegate.offline_mode==false;
|
|
|
+//#else
|
|
|
+// condition = YES;
|
|
|
+//#endif
|
|
|
+// if (condition)
|
|
|
+// {
|
|
|
+// self.btnOpen.enabled =true;
|
|
|
+//
|
|
|
+// self.btnSign.enabled = true;
|
|
|
+// }
|
|
|
+// // self.btnCommit.enabled =false;
|
|
|
+// }
|
|
|
+// BOOL lock_condition_1 = [lock_user isEqualToString:appDelegate.user];
|
|
|
+// BOOL lock_condition_2 = false;
|
|
|
+//#ifdef OFFLINE_MODE
|
|
|
+// lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;
|
|
|
+// lock_condition_2 = appDelegate.offline_mode && [self.order_code isEqualToString:appDelegate.order_code];
|
|
|
+//#endif
|
|
|
+//
|
|
|
+// if((lock_condition_1 || lock_condition_2)&& (status_code==1||status_code==0))
|
|
|
+// {
|
|
|
+// // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
|
|
+//
|
|
|
+//
|
|
|
+// self.btnRelease.enabled =true;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// // [self.btnRelease setImage:[[UIImage imageNamed:@"order"] imageWithRenderingMode:UIImageRenderingModeAutomatic]];
|
|
|
+// self.btnRelease.enabled =false;
|
|
|
+// }
|
|
|
+//
|
|
|
+// [self.detailTable reloadData];
|
|
|
+// self.isrefreshing=false;
|
|
|
+//
|
|
|
+// if (self.order_code == nil) {
|
|
|
+// self.btnCopy.enabled = false;
|
|
|
+// } else {
|
|
|
+// self.btnCopy.enabled = true;
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+//
|
|
|
+// });
|
|
|
});
|
|
|
}
|
|
|
- (void)viewWillAppear:(BOOL)animated
|
|
|
@@ -3541,50 +3723,91 @@
|
|
|
- (void)copyOrder {
|
|
|
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Copy Order"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
- NSDictionary* order_json = [RANetwork copy_Order:self.order_code];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
- if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- // NSString* orderCode = [order_json valueForKey:@"orderCode"];
|
|
|
-
|
|
|
- // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- // if([appDelegate.order_code isEqualToString: self.order_code])
|
|
|
- // {
|
|
|
- // [appDelegate closeOrder];
|
|
|
- //// appDelegate.order_code= nil;
|
|
|
- // [appDelegate SetSo:nil];
|
|
|
- //
|
|
|
- //
|
|
|
- // }
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Copy successful." message:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
-
|
|
|
- [alert show];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ [RANetwork request_copy_order:self.order_code completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* order_json = result;
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+ if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ // NSString* orderCode = [order_json valueForKey:@"orderCode"];
|
|
|
+
|
|
|
+ // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ // if([appDelegate.order_code isEqualToString: self.order_code])
|
|
|
+ // {
|
|
|
+ // [appDelegate closeOrder];
|
|
|
+ //// appDelegate.order_code= nil;
|
|
|
+ // [appDelegate SetSo:nil];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Copy successful." message:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
+
|
|
|
+ [alert show];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
#endif
|
|
|
-
|
|
|
- [self.navigationController popViewControllerAnimated:false];
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Cpoy Order" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ [self.navigationController popViewControllerAnimated:false];
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Cpoy Order" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* order_json = [RANetwork copy_Order:self.order_code];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+// if([[order_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// // NSString* orderCode = [order_json valueForKey:@"orderCode"];
|
|
|
+//
|
|
|
+// // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// // if([appDelegate.order_code isEqualToString: self.order_code])
|
|
|
+// // {
|
|
|
+// // [appDelegate closeOrder];
|
|
|
+// //// appDelegate.order_code= nil;
|
|
|
+// // [appDelegate SetSo:nil];
|
|
|
+// //
|
|
|
+// //
|
|
|
+// // }
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Copy successful." message:[NSString stringWithFormat:@"New order SO#: %@",[order_json valueForKey:@"so_id"]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
+//
|
|
|
+// [alert show];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+//#endif
|
|
|
+//
|
|
|
+// [self.navigationController popViewControllerAnimated:false];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Cpoy Order" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
}
|
|
|
|