|
|
@@ -459,188 +459,190 @@
|
|
|
UIViewController *vc= [RAUtils getViewController:self];
|
|
|
[CartUtils add_to_cart:vc selectorholder:self selector:@selector(addtocart)];
|
|
|
return;
|
|
|
-
|
|
|
-
|
|
|
- int count=[self.quantity_text.text intValue];
|
|
|
-
|
|
|
- UIApplication * app = [UIApplication sharedApplication];
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
- MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
- if(appDelegate.bLogin==false)
|
|
|
- {
|
|
|
- UIViewController *vc= [RAUtils getViewController:self];
|
|
|
- LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
|
|
|
- // loginvc.delegate = self;
|
|
|
- // loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
|
|
|
-
|
|
|
- loginvc.returnValue = ^(bool blogin){
|
|
|
-
|
|
|
-
|
|
|
- // UIApplication * app = [UIApplication sharedApplication];
|
|
|
- // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(blogin)
|
|
|
- {
|
|
|
- if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
|
|
|
- {
|
|
|
- if(self.set_update_data)
|
|
|
- self.set_update_data(true);
|
|
|
- [main_vc checklogin:false];
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to pending a order or a new order", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // alert.
|
|
|
- [alert show];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [main_vc checklogin:true];
|
|
|
-
|
|
|
- int c=[self.count_Label.text intValue];
|
|
|
- DebugLog(@"count label : %@ , convert:%d", self.count_Label.text ,c);
|
|
|
-
|
|
|
- NSString* ct=[self.count_Label.text stringByReplacingOccurrencesOfString:@"\n" withString:@""];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(!appDelegate.can_create_backorder && c<count)
|
|
|
- {
|
|
|
-
|
|
|
- NSString *msg = [NSString stringWithFormat:@"Item is OUT OF STOCK and not available to order from %@.\nAdd to cart anyway?",COMPANY_SHORT_NAME];
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:NSLocalizedString(msg, nil) delegate:self cancelButtonTitle:NSLocalizedString(@"No", nil) otherButtonTitles:NSLocalizedString(@"Yes", nil), nil];
|
|
|
-
|
|
|
- // alert.
|
|
|
-
|
|
|
- alert.tag = 1234;
|
|
|
- [alert show];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
- [ self neworder];
|
|
|
- else
|
|
|
- [self addtocart:count];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // self.offset = 0;
|
|
|
- // [self.content_data removeAllObjects];
|
|
|
- // [self loadpage];
|
|
|
- //
|
|
|
- // [[self navigationController] setNavigationBarHidden:YES animated:NO];
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
|
|
|
-
|
|
|
- navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
|
|
|
- [vc presentViewController:navi animated:YES completion:^{
|
|
|
-
|
|
|
- // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
|
|
|
-
|
|
|
- DebugLog(@"LoginViewController present.........");
|
|
|
-
|
|
|
- // self.btop = false;
|
|
|
- // <#code#>
|
|
|
- }];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
-// if(appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&appDelegate.order_code==nil)
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
- {
|
|
|
- [main_vc checklogin:false];
|
|
|
-
|
|
|
- if(appDelegate.can_create_order)
|
|
|
- {
|
|
|
- NSString* msg =@"";
|
|
|
- if(appDelegate.contact_id.length>0)
|
|
|
- {
|
|
|
- msg = [msg stringByAppendingString:@"\n\nCustomer:"];
|
|
|
- msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
|
|
|
-
|
|
|
- }
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
|
|
|
-
|
|
|
- // alert.
|
|
|
- [alert show];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending order?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
|
|
|
-
|
|
|
- // alert.
|
|
|
- [alert show];
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
-// if ([self.priceLabel.text isEqualToString:@"No Price."])
|
|
|
+//
|
|
|
+//
|
|
|
+// int count=[self.quantity_text.text intValue];
|
|
|
+//
|
|
|
+// UIApplication * app = [UIApplication sharedApplication];
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
+// MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
+// if(appDelegate.bLogin==false)
|
|
|
+// {
|
|
|
+// UIViewController *vc= [RAUtils getViewController:self];
|
|
|
+// LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
|
|
|
+// // loginvc.delegate = self;
|
|
|
+// // loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
|
|
|
+//
|
|
|
+// loginvc.returnValue = ^(bool blogin){
|
|
|
+//
|
|
|
+//
|
|
|
+// // UIApplication * app = [UIApplication sharedApplication];
|
|
|
+// // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if(blogin)
|
|
|
// {
|
|
|
-//// UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Model No Price" message:@"Cannot add model without price." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
-////
|
|
|
-////
|
|
|
-////
|
|
|
-//// [alert show];
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// [RAUtils alert_view:@"Cannot add model without price." title:@"Model No Price."];
|
|
|
+// if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
|
|
|
+// {
|
|
|
+// if(self.set_update_data)
|
|
|
+// self.set_update_data(true);
|
|
|
+// [main_vc checklogin:false];
|
|
|
+//
|
|
|
+//
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to pending a order or a new order", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// // alert.
|
|
|
+// [alert show];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [main_vc checklogin:true];
|
|
|
+//
|
|
|
+// int c=[self.count_Label.text intValue];
|
|
|
+// DebugLog(@"count label : %@ , convert:%d", self.count_Label.text ,c);
|
|
|
+//
|
|
|
+// NSString* ct=[self.count_Label.text stringByReplacingOccurrencesOfString:@"\n" withString:@""];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if(!appDelegate.can_create_backorder && c<count)
|
|
|
+// {
|
|
|
+//
|
|
|
+// NSString *msg = [NSString stringWithFormat:@"Item is OUT OF STOCK and not available to order from %@.\nAdd to cart anyway?",COMPANY_SHORT_NAME];
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:NSLocalizedString(msg, nil) delegate:self cancelButtonTitle:NSLocalizedString(@"No", nil) otherButtonTitles:NSLocalizedString(@"Yes", nil), nil];
|
|
|
+//
|
|
|
+// // alert.
|
|
|
+//
|
|
|
+// alert.tag = 1234;
|
|
|
+// [alert show];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
+// [ self neworder];
|
|
|
+// else
|
|
|
+// [self addtocart:count];
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // self.offset = 0;
|
|
|
+// // [self.content_data removeAllObjects];
|
|
|
+// // [self loadpage];
|
|
|
+// //
|
|
|
+// // [[self navigationController] setNavigationBarHidden:YES animated:NO];
|
|
|
+//
|
|
|
+// };
|
|
|
+//
|
|
|
+// UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
|
|
|
+//
|
|
|
+// navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
|
|
|
+// [vc presentViewController:navi animated:YES completion:^{
|
|
|
+//
|
|
|
+// // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
|
|
|
+//
|
|
|
+// DebugLog(@"LoginViewController present.........");
|
|
|
+//
|
|
|
+// // self.btop = false;
|
|
|
+// // <#code#>
|
|
|
+// }];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+//// if(appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&appDelegate.order_code==nil)
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
+// {
|
|
|
+// [main_vc checklogin:false];
|
|
|
+//
|
|
|
+// if(appDelegate.can_create_order)
|
|
|
+// {
|
|
|
+// NSString* msg =@"";
|
|
|
+// if(appDelegate.contact_id.length>0)
|
|
|
+// {
|
|
|
+// msg = [msg stringByAppendingString:@"\n\nCustomer:"];
|
|
|
+// msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
|
|
|
+//
|
|
|
+// }
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil),NSLocalizedString(@"Add to new order", nil), nil];
|
|
|
+//
|
|
|
+// // alert.
|
|
|
+// [alert show];
|
|
|
// }
|
|
|
// else
|
|
|
- {
|
|
|
-
|
|
|
- int c=[self.count_Label.text intValue];
|
|
|
- DebugLog(@"count label : %@ , convert:%d", self.count_Label.text ,c);
|
|
|
-
|
|
|
- NSString* ct=[self.count_Label.text stringByReplacingOccurrencesOfString:@"\n" withString:@""];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(c<count)
|
|
|
- {
|
|
|
-
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:NSLocalizedString(@"Confirm add to cart. ", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Confirm", nil), nil];
|
|
|
-
|
|
|
- // alert.
|
|
|
-
|
|
|
- alert.tag = 1234;
|
|
|
- [alert show];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
- [ self neworder];
|
|
|
- else
|
|
|
- [self addtocart:count];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+// {
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending order?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Add to pending order", nil), nil];
|
|
|
+//
|
|
|
+// // alert.
|
|
|
+// [alert show];
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+//
|
|
|
+//// if ([self.priceLabel.text isEqualToString:@"No Price."])
|
|
|
+//// {
|
|
|
+////// UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Model No Price" message:@"Cannot add model without price." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
|
|
+//////
|
|
|
+//////
|
|
|
+//////
|
|
|
+////// [alert show];
|
|
|
+////
|
|
|
+////
|
|
|
+////
|
|
|
+//// [RAUtils alert_view:@"Cannot add model without price." title:@"Model No Price."];
|
|
|
+//// }
|
|
|
+//// else
|
|
|
+// {
|
|
|
+//
|
|
|
+// int c=[self.count_Label.text intValue];
|
|
|
+// DebugLog(@"count label : %@ , convert:%d", self.count_Label.text ,c);
|
|
|
+//
|
|
|
+// NSString* ct=[self.count_Label.text stringByReplacingOccurrencesOfString:@"\n" withString:@""];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// if(c<count)
|
|
|
+// {
|
|
|
+//
|
|
|
+// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Availability %@",ct ] message:NSLocalizedString(@"Confirm add to cart. ", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Confirm", nil), nil];
|
|
|
+//
|
|
|
+// // alert.
|
|
|
+//
|
|
|
+// alert.tag = 1234;
|
|
|
+// [alert show];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
+// [ self neworder];
|
|
|
+// else
|
|
|
+// [self addtocart:count];
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
}
|
|
|
-(void) addtocart
|
|
|
{
|
|
|
@@ -1482,136 +1484,136 @@
|
|
|
// });
|
|
|
// });
|
|
|
}
|
|
|
-#pragma mark - UIAlertViewDelegate
|
|
|
-// Called when a button is clicked. The view will be automatically dismissed after this call returns
|
|
|
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
-{
|
|
|
- UIApplication * app = [UIApplication sharedApplication];
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
- if(alertView.tag==1234)//库存小于0
|
|
|
- {
|
|
|
-
|
|
|
- // availability warring;
|
|
|
-
|
|
|
- int count=[self.quantity_text.text intValue];
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
- {
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
- {
|
|
|
- [self neworder];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [self addtocart:count];
|
|
|
- }
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- // int count=[self.quantity_text.text intValue];
|
|
|
-
|
|
|
- MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
- if(buttonIndex==alertView.cancelButtonIndex)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- else if(buttonIndex==1)
|
|
|
- {
|
|
|
- //open exist
|
|
|
- UIViewController *vc= [RAUtils getViewController:self];
|
|
|
- OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
|
|
|
- ovc.showNavibar = true;
|
|
|
- ovc.selectOrder = ^(NSMutableDictionary* order_detail){
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
- {
|
|
|
- [self neworder];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(self.set_update_data)
|
|
|
- self.set_update_data(true);
|
|
|
-
|
|
|
- int model_count = [[order_detail valueForKey:@"model_count"] intValue];
|
|
|
- for(int i=0;i<model_count;i++)
|
|
|
- {
|
|
|
- NSDictionary* item = [order_detail objectForKey:[NSString stringWithFormat:@"item_%d",i]];
|
|
|
- NSString* product_id = [item valueForKey:@"product_id"];
|
|
|
- if([product_id isEqualToString:self.product_id])
|
|
|
- {
|
|
|
- self.cqty = [[item valueForKey:@"QTY"]intValue];
|
|
|
- if(self.set_cqty)
|
|
|
- self.set_cqty(self.cqty);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- int count=[self.quantity_text.text intValue];
|
|
|
- [self addtocart:count];
|
|
|
- [main_vc checklogin:true];
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- };
|
|
|
- ovc.init_style = OL_OPEN;
|
|
|
- ovc.onCancel = ^(){
|
|
|
-
|
|
|
- [main_vc checklogin:true];
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- [vc.navigationController pushViewController:ovc animated:true];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //create new;
|
|
|
- if(appDelegate.customerInfo==nil)// select contact if current contact not exist
|
|
|
- {
|
|
|
- UIViewController *vc= [RAUtils getViewController:self];
|
|
|
-
|
|
|
-
|
|
|
- ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
-
|
|
|
- cvc.showNavibar = true;
|
|
|
- cvc.contact_type = @"Sales_Order_Customer";
|
|
|
- cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
-
|
|
|
- appDelegate.contact_id=[value valueForKey:@"customer_cid"];
|
|
|
- appDelegate.customerInfo = value;
|
|
|
-
|
|
|
-
|
|
|
- if(appDelegate.order_code==nil)
|
|
|
- [self neworder];
|
|
|
-
|
|
|
- [main_vc checklogin:true];
|
|
|
- // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
-
|
|
|
- //
|
|
|
- // if(self.returnValue)
|
|
|
- // self.returnValue(value);
|
|
|
- };
|
|
|
-
|
|
|
- cvc.onCancel = ^(){
|
|
|
-
|
|
|
- UIViewController *vc= [RAUtils getViewController:self];
|
|
|
- [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order" controller:vc];
|
|
|
-
|
|
|
- };
|
|
|
- cvc.onReset = ^(){
|
|
|
- [main_vc checklogin:true];
|
|
|
- };
|
|
|
-
|
|
|
- [vc.navigationController pushViewController:cvc animated:true];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [self neworder];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
+//#pragma mark - UIAlertViewDelegate
|
|
|
+//// Called when a button is clicked. The view will be automatically dismissed after this call returns
|
|
|
+//- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
+//{
|
|
|
+// UIApplication * app = [UIApplication sharedApplication];
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
+// if(alertView.tag==1234)//库存小于0
|
|
|
+// {
|
|
|
+//
|
|
|
+// // availability warring;
|
|
|
+//
|
|
|
+// int count=[self.quantity_text.text intValue];
|
|
|
+// if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
+// {
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
+// {
|
|
|
+// [self neworder];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [self addtocart:count];
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// // int count=[self.quantity_text.text intValue];
|
|
|
+//
|
|
|
+// MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
+// if(buttonIndex==alertView.cancelButtonIndex)
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if(buttonIndex==1)
|
|
|
+// {
|
|
|
+// //open exist
|
|
|
+// UIViewController *vc= [RAUtils getViewController:self];
|
|
|
+// OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
|
|
|
+// ovc.showNavibar = true;
|
|
|
+// ovc.selectOrder = ^(NSMutableDictionary* order_detail){
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
+// {
|
|
|
+// [self neworder];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(self.set_update_data)
|
|
|
+// self.set_update_data(true);
|
|
|
+//
|
|
|
+// int model_count = [[order_detail valueForKey:@"model_count"] intValue];
|
|
|
+// for(int i=0;i<model_count;i++)
|
|
|
+// {
|
|
|
+// NSDictionary* item = [order_detail objectForKey:[NSString stringWithFormat:@"item_%d",i]];
|
|
|
+// NSString* product_id = [item valueForKey:@"product_id"];
|
|
|
+// if([product_id isEqualToString:self.product_id])
|
|
|
+// {
|
|
|
+// self.cqty = [[item valueForKey:@"QTY"]intValue];
|
|
|
+// if(self.set_cqty)
|
|
|
+// self.set_cqty(self.cqty);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// int count=[self.quantity_text.text intValue];
|
|
|
+// [self addtocart:count];
|
|
|
+// [main_vc checklogin:true];
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// };
|
|
|
+// ovc.init_style = OL_OPEN;
|
|
|
+// ovc.onCancel = ^(){
|
|
|
+//
|
|
|
+// [main_vc checklogin:true];
|
|
|
+//
|
|
|
+// };
|
|
|
+//
|
|
|
+// [vc.navigationController pushViewController:ovc animated:true];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// //create new;
|
|
|
+// if(appDelegate.customerInfo==nil)// select contact if current contact not exist
|
|
|
+// {
|
|
|
+// UIViewController *vc= [RAUtils getViewController:self];
|
|
|
+//
|
|
|
+//
|
|
|
+// ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
+//
|
|
|
+// cvc.showNavibar = true;
|
|
|
+// cvc.contact_type = @"Sales_Order_Customer";
|
|
|
+// cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
+//
|
|
|
+// appDelegate.contact_id=[value valueForKey:@"customer_cid"];
|
|
|
+// appDelegate.customerInfo = value;
|
|
|
+//
|
|
|
+//
|
|
|
+// if(appDelegate.order_code==nil)
|
|
|
+// [self neworder];
|
|
|
+//
|
|
|
+// [main_vc checklogin:true];
|
|
|
+// // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+//
|
|
|
+// //
|
|
|
+// // if(self.returnValue)
|
|
|
+// // self.returnValue(value);
|
|
|
+// };
|
|
|
+//
|
|
|
+// cvc.onCancel = ^(){
|
|
|
+//
|
|
|
+// UIViewController *vc= [RAUtils getViewController:self];
|
|
|
+// [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order" controller:vc];
|
|
|
+//
|
|
|
+// };
|
|
|
+// cvc.onReset = ^(){
|
|
|
+// [main_vc checklogin:true];
|
|
|
+// };
|
|
|
+//
|
|
|
+// [vc.navigationController pushViewController:cvc animated:true];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [self neworder];
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+//}
|
|
|
|
|
|
- (void)valueChanged:(UIStepper *)sender {
|
|
|
|