|
|
@@ -624,127 +624,337 @@
|
|
|
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Processing"];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [RANetwork request_portfoliopreview:params completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* editor_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
|
- NSDictionary* editor_json = [RANetwork request_TearSheet:params];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ if([[editor_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+
|
|
|
+ NSString* url = [editor_json valueForKey:@"pdf_path"];
|
|
|
+ NSString* path = [editor_json valueForKey:@"pdf_real_path"];
|
|
|
+ bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
|
|
|
+ RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
|
|
|
+ ViewController.url = url;
|
|
|
+ ViewController.canSave = true;
|
|
|
+ ViewController.isLocalfile=isLocalFile;
|
|
|
|
|
|
+ ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
|
|
|
+ ViewController.save_name =catelog_name;
|
|
|
+ ViewController.save_note =internal_note;
|
|
|
|
|
|
- if([[editor_json valueForKey:@"result"] intValue]==2)
|
|
|
+ NSString* company= [appDelegate.customerInfo valueForKey:@"customer_name"];
|
|
|
+
|
|
|
+ if(company==nil)
|
|
|
+ company=@"";
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ NSString* subject;
|
|
|
+
|
|
|
+ subject =catelog_name;
|
|
|
+
|
|
|
+ ViewController.mail_subject = subject;
|
|
|
+
|
|
|
+ ViewController.onSavePDF=^(NSString* name,NSString* file)
|
|
|
{
|
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
-
|
|
|
- NSString* url = [editor_json valueForKey:@"pdf_path"];
|
|
|
- NSString* path = [editor_json valueForKey:@"pdf_real_path"];
|
|
|
- bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
|
|
|
- RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
|
|
|
- ViewController.url = url;
|
|
|
- ViewController.canSave = true;
|
|
|
- ViewController.isLocalfile=isLocalFile;
|
|
|
-
|
|
|
- ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
|
|
|
- ViewController.save_name =catelog_name;
|
|
|
- ViewController.save_note =internal_note;
|
|
|
-
|
|
|
- NSString* company= [appDelegate.customerInfo valueForKey:@"customer_name"];
|
|
|
-
|
|
|
- if(company==nil)
|
|
|
- company=@"";
|
|
|
-
|
|
|
- NSString* customer_email= [appDelegate.customerInfo valueForKey:@"customer_email"];
|
|
|
|
|
|
+ NSString* del_ids = nil;
|
|
|
|
|
|
- NSMutableArray* send_to = [[NSMutableArray alloc]init];
|
|
|
- if(customer_email.length>0)
|
|
|
+ UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving..."];
|
|
|
+#ifdef OFFLINE_MODE
|
|
|
+ if (appDelegate.offline_mode)
|
|
|
{
|
|
|
- send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
|
|
|
+ [params setValue:url forKey:@"pdfPath"];
|
|
|
}
|
|
|
- ViewController.mail_to = send_to;
|
|
|
-
|
|
|
- NSString* subject;
|
|
|
-
|
|
|
- subject =catelog_name;
|
|
|
-
|
|
|
- ViewController.mail_subject = subject;
|
|
|
-
|
|
|
- ViewController.onSavePDF=^(NSString* name,NSString* file)
|
|
|
+ else
|
|
|
+#endif
|
|
|
{
|
|
|
+ [params setValue:path forKey:@"pdfPath"];
|
|
|
+ }
|
|
|
+ [params setValue:name forKey:@"pdfName"];
|
|
|
+ [params setValue:internal_note forKey:@"pdfNote"];
|
|
|
+ [params setValue:del_ids forKey:@"itemIds"];
|
|
|
+ [params setValue:pdf_url forKey:@"configureParams"];
|
|
|
+
|
|
|
+ [RANetwork request_save_portfolio:params completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* json =result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
|
|
|
|
- NSString* del_ids = nil;
|
|
|
-
|
|
|
- UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving..."];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
-
|
|
|
-#ifdef OFFLINE_MODE
|
|
|
- if (appDelegate.offline_mode)
|
|
|
- {
|
|
|
- [params setValue:url forKey:@"pdfPath"];
|
|
|
- }
|
|
|
- else
|
|
|
-#endif
|
|
|
- {
|
|
|
- [params setValue:path forKey:@"pdfPath"];
|
|
|
- }
|
|
|
- [params setValue:name forKey:@"pdfName"];
|
|
|
- [params setValue:internal_note forKey:@"pdfNote"];
|
|
|
- [params setValue:del_ids forKey:@"itemIds"];
|
|
|
- [params setValue:pdf_url forKey:@"configureParams"];
|
|
|
-
|
|
|
+ if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
|
|
|
+ [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
|
|
|
|
|
|
- NSDictionary* json = [RANetwork save_TearSheet:params];
|
|
|
+ // [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ [self.navigationController dismissViewControllerAnimated:true completion:^{
|
|
|
+
|
|
|
|
|
|
|
|
|
- if([[json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
-
|
|
|
- [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
|
|
|
-
|
|
|
-// [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
|
|
|
-
|
|
|
- [self.navigationController dismissViewControllerAnimated:true completion:^{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
#else
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
|
|
|
#endif
|
|
|
- }];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
|
|
|
+ }
|
|
|
|
|
|
- };
|
|
|
-
|
|
|
- ViewController.hidenavi = false;
|
|
|
- [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
+ }];
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
|
|
|
- }
|
|
|
+ // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //#ifdef OFFLINE_MODE
|
|
|
+ // if (appDelegate.offline_mode)
|
|
|
+ // {
|
|
|
+ // [params setValue:url forKey:@"pdfPath"];
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ //#endif
|
|
|
+ // {
|
|
|
+ // [params setValue:path forKey:@"pdfPath"];
|
|
|
+ // }
|
|
|
+ // [params setValue:name forKey:@"pdfName"];
|
|
|
+ // [params setValue:internal_note forKey:@"pdfNote"];
|
|
|
+ // [params setValue:del_ids forKey:@"itemIds"];
|
|
|
+ // [params setValue:pdf_url forKey:@"configureParams"];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // NSDictionary* json = [RANetwork save_TearSheet:params];
|
|
|
+ //
|
|
|
+ // dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ // [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+ // {
|
|
|
+ //
|
|
|
+ // [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
|
|
|
+ //
|
|
|
+ //// [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
|
|
|
+ //
|
|
|
+ // [self.navigationController dismissViewControllerAnimated:true completion:^{
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //#ifdef RA_NOTIFICATION
|
|
|
+ // [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ //#else
|
|
|
+ // [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
|
|
|
+ // [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
|
|
|
+ //#endif
|
|
|
+ // }];
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ ViewController.hidenavi = false;
|
|
|
+ [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* editor_json = [RANetwork request_TearSheet:params];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[editor_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+//
|
|
|
+// NSString* url = [editor_json valueForKey:@"pdf_path"];
|
|
|
+// NSString* path = [editor_json valueForKey:@"pdf_real_path"];
|
|
|
+// bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
|
|
|
+// RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
|
|
|
+// ViewController.url = url;
|
|
|
+// ViewController.canSave = true;
|
|
|
+// ViewController.isLocalfile=isLocalFile;
|
|
|
+//
|
|
|
+// ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
|
|
|
+// ViewController.save_name =catelog_name;
|
|
|
+// ViewController.save_note =internal_note;
|
|
|
+//
|
|
|
+// NSString* company= [appDelegate.customerInfo valueForKey:@"customer_name"];
|
|
|
+//
|
|
|
+// if(company==nil)
|
|
|
+// company=@"";
|
|
|
+//
|
|
|
+// 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;
|
|
|
+//
|
|
|
+// NSString* subject;
|
|
|
+//
|
|
|
+// subject =catelog_name;
|
|
|
+//
|
|
|
+// ViewController.mail_subject = subject;
|
|
|
+//
|
|
|
+// ViewController.onSavePDF=^(NSString* name,NSString* file)
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// NSString* del_ids = nil;
|
|
|
+//
|
|
|
+// UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving..."];
|
|
|
+// #ifdef OFFLINE_MODE
|
|
|
+// if (appDelegate.offline_mode)
|
|
|
+// {
|
|
|
+// [params setValue:url forKey:@"pdfPath"];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// #endif
|
|
|
+// {
|
|
|
+// [params setValue:path forKey:@"pdfPath"];
|
|
|
+// }
|
|
|
+// [params setValue:name forKey:@"pdfName"];
|
|
|
+// [params setValue:internal_note forKey:@"pdfNote"];
|
|
|
+// [params setValue:del_ids forKey:@"itemIds"];
|
|
|
+// [params setValue:pdf_url forKey:@"configureParams"];
|
|
|
+//
|
|
|
+// [RANetwork request_save_portfolio:params completionHandler:^(NSMutableDictionary *result) {
|
|
|
+// NSDictionary* json =result;
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
|
|
|
+//
|
|
|
+// // [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
|
|
|
+//
|
|
|
+// [self.navigationController dismissViewControllerAnimated:true completion:^{
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
|
|
|
+//#endif
|
|
|
+// }];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+// }];
|
|
|
+//
|
|
|
+//// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+////
|
|
|
+////
|
|
|
+////#ifdef OFFLINE_MODE
|
|
|
+//// if (appDelegate.offline_mode)
|
|
|
+//// {
|
|
|
+//// [params setValue:url forKey:@"pdfPath"];
|
|
|
+//// }
|
|
|
+//// else
|
|
|
+////#endif
|
|
|
+//// {
|
|
|
+//// [params setValue:path forKey:@"pdfPath"];
|
|
|
+//// }
|
|
|
+//// [params setValue:name forKey:@"pdfName"];
|
|
|
+//// [params setValue:internal_note forKey:@"pdfNote"];
|
|
|
+//// [params setValue:del_ids forKey:@"itemIds"];
|
|
|
+//// [params setValue:pdf_url forKey:@"configureParams"];
|
|
|
+////
|
|
|
+////
|
|
|
+////
|
|
|
+//// NSDictionary* json = [RANetwork save_TearSheet:params];
|
|
|
+////
|
|
|
+//// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+////
|
|
|
+////
|
|
|
+//// if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+//// {
|
|
|
+////
|
|
|
+//// [RAUtils message_alert:@"Portfolio saved. You can find it from View Portfolios" title:@"Portfolio" controller:self];
|
|
|
+////
|
|
|
+////// [RAUtils alert_view:nil title:@"Portfolio saved. You can find it from View Portfolios" ] ;
|
|
|
+////
|
|
|
+//// [self.navigationController dismissViewControllerAnimated:true completion:^{
|
|
|
+////
|
|
|
+////
|
|
|
+////
|
|
|
+////#ifdef RA_NOTIFICATION
|
|
|
+//// [ActiveViewController Notify:@"PortfolioViewController,PDFListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+////#else
|
|
|
+//// [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:true];
|
|
|
+//// [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
|
|
|
+////#endif
|
|
|
+//// }];
|
|
|
+//// }
|
|
|
+//// else
|
|
|
+//// {
|
|
|
+//// [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save Portfolio" controller:self] ;
|
|
|
+//// }
|
|
|
+////
|
|
|
+//// });
|
|
|
+//// });
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// };
|
|
|
+//
|
|
|
+// ViewController.hidenavi = false;
|
|
|
+// [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Portfolio" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -915,76 +1125,141 @@
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Updating Quantity"];
|
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
- NSDictionary* cart_json = nil;
|
|
|
+ [RANetwork request_update_portfolio_price:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]] price:price discount:discount QTY:qty qty_p:qty_p notes:notes completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* cart_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
|
- cart_json= [RANetwork portfolio_setPrice:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]] price:price discount:discount QTY:qty qty_p:qty_p notes:notes];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ // if(qty>=0)
|
|
|
+ // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+ // else
|
|
|
+ // [item_json removeObjectForKey:@"available_qty"];
|
|
|
+ // if(qty_p>=0)
|
|
|
+ // item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
+ // else
|
|
|
+ // [item_json removeObjectForKey:@"available_percent"];
|
|
|
+ // item_json[@"linenotes"]=notes;
|
|
|
+ // item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
+ // item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
+ // self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
|
|
|
+ // // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+ // [self.itemListTable reloadData];
|
|
|
|
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
-// if(qty>=0)
|
|
|
-// item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
-// else
|
|
|
-// [item_json removeObjectForKey:@"available_qty"];
|
|
|
-// if(qty_p>=0)
|
|
|
-// item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
-// else
|
|
|
-// [item_json removeObjectForKey:@"available_percent"];
|
|
|
-// item_json[@"linenotes"]=notes;
|
|
|
-// item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
-// item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
-// self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
|
|
|
-// // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
-// [self.itemListTable reloadData];
|
|
|
-
|
|
|
-
|
|
|
- if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
|
|
|
- // qty
|
|
|
- if (qty != -INT32_MAX)
|
|
|
- item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
- else
|
|
|
- [item_json removeObjectForKey:@"available_qty"];
|
|
|
-
|
|
|
- // qty_p
|
|
|
- if (qty_p != -MAXFLOAT)
|
|
|
- item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
- else
|
|
|
- [item_json removeObjectForKey:@"available_percent"];
|
|
|
- }
|
|
|
-
|
|
|
- if (notes) {
|
|
|
- item_json[@"linenotes"]=notes;
|
|
|
- }
|
|
|
-
|
|
|
- if (discount != -MAXFLOAT) {
|
|
|
- item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
- }
|
|
|
-
|
|
|
- if (price != -MAXFLOAT) {
|
|
|
- item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
- }
|
|
|
-
|
|
|
- self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
|
|
|
- // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
-
|
|
|
- [self.itemListTable reloadData];
|
|
|
+ if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
|
|
|
+ // qty
|
|
|
+ if (qty != -INT32_MAX)
|
|
|
+ item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+ else
|
|
|
+ [item_json removeObjectForKey:@"available_qty"];
|
|
|
|
|
|
+ // qty_p
|
|
|
+ if (qty_p != -MAXFLOAT)
|
|
|
+ item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
+ else
|
|
|
+ [item_json removeObjectForKey:@"available_percent"];
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+
|
|
|
+ if (notes) {
|
|
|
+ item_json[@"linenotes"]=notes;
|
|
|
}
|
|
|
|
|
|
+ if (discount != -MAXFLOAT) {
|
|
|
+ item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
+ }
|
|
|
|
|
|
+ if (price != -MAXFLOAT) {
|
|
|
+ item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
+ }
|
|
|
|
|
|
+ self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
|
|
|
+ // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ [self.itemListTable reloadData];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* cart_json = nil;
|
|
|
+//
|
|
|
+// cart_json= [RANetwork portfolio_setPrice:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]] price:price discount:discount QTY:qty qty_p:qty_p notes:notes];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//// if(qty>=0)
|
|
|
+//// item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+//// else
|
|
|
+//// [item_json removeObjectForKey:@"available_qty"];
|
|
|
+//// if(qty_p>=0)
|
|
|
+//// item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
+//// else
|
|
|
+//// [item_json removeObjectForKey:@"available_percent"];
|
|
|
+//// item_json[@"linenotes"]=notes;
|
|
|
+//// item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
+//// item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
+//// self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
|
|
|
+//// // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+//// [self.itemListTable reloadData];
|
|
|
+//
|
|
|
+//
|
|
|
+// if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
|
|
|
+// // qty
|
|
|
+// if (qty != -INT32_MAX)
|
|
|
+// item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+// else
|
|
|
+// [item_json removeObjectForKey:@"available_qty"];
|
|
|
+//
|
|
|
+// // qty_p
|
|
|
+// if (qty_p != -MAXFLOAT)
|
|
|
+// item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
+// else
|
|
|
+// [item_json removeObjectForKey:@"available_percent"];
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (notes) {
|
|
|
+// item_json[@"linenotes"]=notes;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (discount != -MAXFLOAT) {
|
|
|
+// item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (price != -MAXFLOAT) {
|
|
|
+// item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
+// }
|
|
|
+//
|
|
|
+// self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
|
|
|
+// // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+//
|
|
|
+// [self.itemListTable reloadData];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
@@ -1054,32 +1329,51 @@
|
|
|
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Updating Quantity"];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [RANetwork request_update_portfolio_price:ids price:price discount:discount QTY:qty qty_p:qty_p notes:notes completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* cart_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
|
- NSDictionary* cart_json = nil;
|
|
|
|
|
|
- cart_json= [RANetwork portfolio_setPrice:ids price:price discount:discount QTY:qty qty_p:qty_p notes:notes];
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[NSString stringWithFormat:@"%ld items saved.",checked.count] title:@"Edit Portfolio" controller:self] ;
|
|
|
+ [self reload_data];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+ }
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
-
|
|
|
-
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- [RAUtils message_alert:[NSString stringWithFormat:@"%ld items saved.",checked.count] title:@"Edit Portfolio" controller:self] ;
|
|
|
- [self reload_data];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* cart_json = nil;
|
|
|
+//
|
|
|
+// cart_json= [RANetwork portfolio_setPrice:ids price:price discount:discount QTY:qty qty_p:qty_p notes:notes];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[NSString stringWithFormat:@"%ld items saved.",checked.count] title:@"Edit Portfolio" controller:self] ;
|
|
|
+// [self reload_data];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
@@ -1673,61 +1967,112 @@
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Updating Quantity"];
|
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [RANetwork request_update_portfolio_price:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]] price:price discount:discount QTY:qty qty_p:qty_p notes:notes completionHandler:^(NSMutableDictionary *result) {
|
|
|
|
|
|
- NSDictionary* cart_json = nil;
|
|
|
+ NSDictionary* cart_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
|
- cart_json= [RANetwork portfolio_setPrice:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]] price:price discount:discount QTY:qty qty_p:qty_p notes:notes];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
-
|
|
|
+ if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ self.editedRow = indexPath.row;
|
|
|
|
|
|
- if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- self.editedRow = indexPath.row;
|
|
|
-
|
|
|
- if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
|
|
|
- // qty
|
|
|
- if (qty != -INT32_MAX)
|
|
|
- item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
- else
|
|
|
- [item_json removeObjectForKey:@"available_qty"];
|
|
|
-
|
|
|
- // qty_p
|
|
|
- if (qty_p != -MAXFLOAT)
|
|
|
- item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
- else
|
|
|
- [item_json removeObjectForKey:@"available_percent"];
|
|
|
- }
|
|
|
-
|
|
|
- if (notes) {
|
|
|
- item_json[@"linenotes"]=notes;
|
|
|
- }
|
|
|
-
|
|
|
- if (discount != -MAXFLOAT) {
|
|
|
- item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
- }
|
|
|
-
|
|
|
- if (price != -MAXFLOAT) {
|
|
|
- item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
- }
|
|
|
+ if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
|
|
|
+ // qty
|
|
|
+ if (qty != -INT32_MAX)
|
|
|
+ item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+ else
|
|
|
+ [item_json removeObjectForKey:@"available_qty"];
|
|
|
|
|
|
- self.content_data[[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]]=item_json;
|
|
|
- // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
- self.indexPath=indexPath;
|
|
|
- [self.itemListTable reloadData];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+ // qty_p
|
|
|
+ if (qty_p != -MAXFLOAT)
|
|
|
+ item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
+ else
|
|
|
+ [item_json removeObjectForKey:@"available_percent"];
|
|
|
}
|
|
|
|
|
|
+ if (notes) {
|
|
|
+ item_json[@"linenotes"]=notes;
|
|
|
+ }
|
|
|
|
|
|
+ if (discount != -MAXFLOAT) {
|
|
|
+ item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
+ }
|
|
|
|
|
|
+ if (price != -MAXFLOAT) {
|
|
|
+ item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ self.content_data[[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]]=item_json;
|
|
|
+ // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+ self.indexPath=indexPath;
|
|
|
+ [self.itemListTable reloadData];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* cart_json = nil;
|
|
|
+//
|
|
|
+// cart_json= [RANetwork portfolio_setPrice:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]] price:price discount:discount QTY:qty qty_p:qty_p notes:notes];
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+// if([[cart_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// self.editedRow = indexPath.row;
|
|
|
+//
|
|
|
+// if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
|
|
|
+// // qty
|
|
|
+// if (qty != -INT32_MAX)
|
|
|
+// item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+// else
|
|
|
+// [item_json removeObjectForKey:@"available_qty"];
|
|
|
+//
|
|
|
+// // qty_p
|
|
|
+// if (qty_p != -MAXFLOAT)
|
|
|
+// item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
|
|
|
+// else
|
|
|
+// [item_json removeObjectForKey:@"available_percent"];
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (notes) {
|
|
|
+// item_json[@"linenotes"]=notes;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (discount != -MAXFLOAT) {
|
|
|
+// item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (price != -MAXFLOAT) {
|
|
|
+// item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
|
|
|
+// }
|
|
|
+//
|
|
|
+// self.content_data[[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]]=item_json;
|
|
|
+// // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
|
|
|
+// self.indexPath=indexPath;
|
|
|
+// [self.itemListTable reloadData];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Edit Portfolio" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
@@ -2179,7 +2524,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:
|
|
|
|
|
|
reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
|
|
|
|
|
|
- [RANetwork request_portfolio:self.sortIndex completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ [RANetwork request_portfoliolist:self.sortIndex completionHandler:^(NSMutableDictionary *result) {
|
|
|
NSMutableDictionary* cart_json =result;
|
|
|
[self.mum stopAnimating];
|
|
|
|