Pen Li 9 سال پیش
والد
کامیت
8089f834b5

+ 0 - 14
RedAnt ERP Mobile/iSales-NPD/CartUtils.h

@@ -1,14 +0,0 @@
-//
-//  CartUtils.h
-//  iSales-NPD
-//
-//  Created by Ray on 12/26/16.
-//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-typedef void (^add_to_cart_Handler)(void);
-@interface CartUtils : NSObject
-+(void) add_to_cart:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart;
-+(void) add_recent_model:(NSDictionary*) model;
-@end

+ 0 - 756
RedAnt ERP Mobile/iSales-NPD/CartUtils.m

@@ -1,756 +0,0 @@
-//
-//  CartUtils.m
-//  iSales-NPD
-//
-//  Created by Ray on 12/26/16.
-//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
-//
-
-#import "CartUtils.h"
-#import "RAUtils.h"
-#import "AppDelegate.h"
-#import "iSalesNetwork.h"
-#import "LoginViewController.h"
-#import "MainViewController.h"
-
-
-@implementation CartUtils
-+(void) neworder:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart
-{
-
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
-        NSDictionary* return_json = [iSalesNetwork new_Order];
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-
-
-            if([[return_json valueForKey:@"result"] intValue]==2)
-            {
-                int result=[[return_json valueForKey:@"result"] intValue];
-                if(result==2)
-                {
-                    //successed.
-
-                    NSString* order_code = [return_json valueForKey:@"orderCode"];
-                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                    appDelegate.order_code = order_code;
-                    appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
-
-                    [holder performSelector:addtocart];
-
-
-                    //    [self ReloadData];
-
-
-                    //                    if(self.shopCartBlock!=nil)
-                    //                    {
-                    //                        UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
-                    //
-                    //
-                    //                        CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
-                    //                        UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
-                    //                        iv.image = img;
-                    //                        //                        [self.contentView addSubview:iv];
-                    //                        self.shopCartBlock(iv);
-                    //
-                    //                    }
-
-                }
-            }
-            else
-            {
-                [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:vc] ;
-            }
-
-
-
-
-        });
-    });
-}
-
-+(void) add_to_cart:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart
-{
-    UIApplication * app = [UIApplication sharedApplication];
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-
-
-
-    if(appDelegate.bLogin==false)
-    {
-
-        LoginViewController * loginvc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
-
-        loginvc.returnValue = ^(bool blogin){
-
-            if(blogin)
-            {
-                if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
-                {
-
-                    [main_vc checklogin:false];
-
-
-                    NSString* msg =@"";
-                    //                    if(appDelegate.contact_id.length>0)
-                    //                    {
-                    //                        msg = [msg stringByAppendingString:@"Customer:"];
-                    //                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-                    //
-                    //                    }
-
-                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                    //block代码块取代了delegate
-
-
-
-                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                        //  vc.disable_refresh = true;
-                        OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-                        ovc.showNavibar = true;
-                        //ovc.customer_id = appDelegate.contact_id;
-                        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-
-                            [holder performSelector:addtocart];
-
-
-                        };
-                        ovc.init_style = OL_OPEN;
-
-                        ovc.onCancel = ^(){
-
-                            //  self.disable_refresh = false;
-
-
-
-                        };
-
-                        [vc.navigationController pushViewController:ovc animated:true];
-
-
-
-
-
-                    }];
-
-                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                        {
-                            //create new;
-                            //    self.disable_refresh = true;
-                            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-                            {
-                                ContactListViewController* cvc = [vc.storyboard 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:vc selectorholder:holder selector:addtocart];
-                                    //                                                            neworder();
-
-                                    //    [main_vc checklogin:true];
-                                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-
-                                    //
-                                    //                if(self.returnValue)
-                                    //                    self.returnValue(value);
-                                };
-
-                                cvc.onCancel = ^(){
-
-                                    [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
-
-                                    // self.disable_refresh = false;
-
-                                };
-                                cvc.onReset = ^(){
-                                    // [main_vc checklogin:true];
-                                };
-
-                                [vc.navigationController pushViewController:cvc animated:true];
-                            }
-                            else
-                            {
-                                [self neworder:vc selectorholder:holder selector:addtocart];
-                            }
-
-                        }
-
-
-                        DebugLog(@"No");
-                    }];
-                    [alertControl addAction:actionOne];
-
-                    [alertControl addAction:alertthree];
-
-                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                    }];
-                    [alertControl addAction:alertcancel];
-
-                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                    [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-
-
-                }
-
-                else
-                {
-
-                    //customer login;
-                    [main_vc checklogin:false];
-                    //[self addtocart];
-                    [holder performSelector:addtocart];
-                }
-            }
-
-
-        };
-
-        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.contact_id.length==0)
-            {
-
-
-
-                NSString* msg =@"";
-
-
-                UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                //block代码块取代了delegate
-
-
-
-                UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                    //  vc.disable_refresh = true;
-                    OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-                    ovc.showNavibar = true;
-                    //ovc.customer_id = appDelegate.contact_id;
-                    ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-
-                        [holder performSelector:addtocart];
-
-
-                    };
-                    ovc.init_style = OL_OPEN;
-
-                    ovc.onCancel = ^(){
-
-                        //  self.disable_refresh = false;
-
-
-
-                    };
-
-                    [vc.navigationController pushViewController:ovc animated:true];
-
-
-
-
-
-                }];
-
-                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                    {
-                        //create new;
-                        //    self.disable_refresh = true;
-                        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-                        {
-                            ContactListViewController* cvc = [vc.storyboard 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:vc selectorholder:holder selector:addtocart];
-                                //                                                            neworder();
-
-                                //    [main_vc checklogin:true];
-                                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-
-                                //
-                                //                if(self.returnValue)
-                                //                    self.returnValue(value);
-                            };
-
-                            cvc.onCancel = ^(){
-
-                                [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
-
-                                // self.disable_refresh = false;
-
-                            };
-                            cvc.onReset = ^(){
-                                // [main_vc checklogin:true];
-                            };
-
-                            [vc.navigationController pushViewController:cvc animated:true];
-                        }
-                        else
-                        {
-                            [self neworder:vc selectorholder:holder selector:addtocart];
-                        }
-
-                    }
-
-
-                    DebugLog(@"No");
-                }];
-                [alertControl addAction:actionOne];
-
-                [alertControl addAction:alertthree];
-                UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                }];
-                [alertControl addAction:alertcancel];
-
-                //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-
-
-            }
-
-            else
-
-            {
-
-                UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Checking Pending Order"];
-
-
-
-
-                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
-                    NSDictionary* return_json = [iSalesNetwork request_PendingOrder:appDelegate.contact_id];
-
-                    dispatch_async(dispatch_get_main_queue(), ^{
-
-                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-
-                        if([[return_json valueForKey:@"result"] intValue]==2)
-                        {
-
-                            bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
-                            bool createNewOrder=appDelegate.can_create_order;
-
-                            if(openPendingOrder&&createNewOrder)
-                            {
-
-                                NSString* msg =@"";
-                                if(appDelegate.contact_id.length>0)
-                                {
-                                    msg = [msg stringByAppendingString:@"Customer:"];
-                                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-
-                                }
-
-                                UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                                //block代码块取代了delegate
-
-
-
-                                UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                                    //  vc.disable_refresh = true;
-                                    OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-                                    ovc.showNavibar = true;
-                                    ovc.customer_id = appDelegate.contact_id;
-                                    ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-
-                                        [holder performSelector:addtocart];
-
-
-                                    };
-                                    ovc.init_style = OL_OPEN;
-
-                                    ovc.onCancel = ^(){
-
-                                        //  self.disable_refresh = false;
-
-
-
-                                    };
-
-                                    [vc.navigationController pushViewController:ovc animated:true];
-
-
-
-
-
-                                }];
-
-                                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                                    {
-                                        //create new;
-                                        //    self.disable_refresh = true;
-                                        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-                                        {
-                                            ContactListViewController* cvc = [vc.storyboard 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:vc selectorholder:holder selector:addtocart];
-                                                //                                                            neworder();
-
-                                                //    [main_vc checklogin:true];
-                                                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-
-                                                //
-                                                //                if(self.returnValue)
-                                                //                    self.returnValue(value);
-                                            };
-
-                                            cvc.onCancel = ^(){
-
-                                                [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
-
-                                                // self.disable_refresh = false;
-
-                                            };
-                                            cvc.onReset = ^(){
-                                                // [main_vc checklogin:true];
-                                            };
-
-                                            [vc.navigationController pushViewController:cvc animated:true];
-                                        }
-                                        else
-                                        {
-                                            [self neworder:vc selectorholder:holder selector:addtocart];
-                                        }
-
-                                    }
-
-
-                                    DebugLog(@"No");
-                                }];
-                                [alertControl addAction:actionOne];
-
-                                [alertControl addAction:alertthree];
-
-                                UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                                }];
-                                [alertControl addAction:alertcancel];
-                                //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                                [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-
-                            }
-                            else
-                            {
-                                if(openPendingOrder)
-                                {
-                                    NSString* msg =@"";
-                                    if(appDelegate.contact_id.length>0)
-                                    {
-                                        msg = [msg stringByAppendingString:@"Customer:"];
-                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-
-                                    }
-
-                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                                    //block代码块取代了delegate
-
-
-
-                                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                                        //  vc.disable_refresh = true;
-                                        OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-                                        ovc.showNavibar = true;
-                                        ovc.customer_id = appDelegate.contact_id;
-                                        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-
-                                            [holder performSelector:addtocart];
-
-
-                                        };
-                                        ovc.init_style = OL_OPEN;
-
-                                        ovc.onCancel = ^(){
-
-                                            //  self.disable_refresh = false;
-
-
-
-                                        };
-
-                                        [vc.navigationController pushViewController:ovc animated:true];
-
-
-
-
-
-                                    }];
-
-
-                                    [alertControl addAction:actionOne];
-                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                                    }];
-                                    [alertControl addAction:alertcancel];
-
-                                    //   [alertControl addAction:alertthree];
-
-                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                                    [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-
-
-                                }
-                                else if(createNewOrder)
-                                {
-                                    NSString* msg =@"";
-                                    if(appDelegate.contact_id.length>0)
-                                    {
-                                        msg = [msg stringByAppendingString:@"Customer:"];
-                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-
-                                    }
-
-                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                                    //block代码块取代了delegate
-
-
-
-
-
-                                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                                        {
-                                            //create new;
-                                            //    self.disable_refresh = true;
-                                            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-                                            {
-                                                ContactListViewController* cvc = [vc.storyboard 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:vc selectorholder:holder selector:addtocart];
-                                                    //                                                            neworder();
-
-                                                    //    [main_vc checklogin:true];
-                                                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-
-                                                    //
-                                                    //                if(self.returnValue)
-                                                    //                    self.returnValue(value);
-                                                };
-
-                                                cvc.onCancel = ^(){
-
-                                                    [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
-
-                                                    // self.disable_refresh = false;
-
-                                                };
-                                                cvc.onReset = ^(){
-                                                    // [main_vc checklogin:true];
-                                                };
-
-                                                [vc.navigationController pushViewController:cvc animated:true];
-                                            }
-                                            else
-                                            {
-                                                [self neworder:vc selectorholder:holder selector:addtocart];
-                                            }
-
-                                        }
-
-
-                                        DebugLog(@"No");
-                                    }];
-                                    //                                        [alertControl addAction:actionOne];
-
-                                    [alertControl addAction:alertthree];
-
-                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                                    }];
-                                    [alertControl addAction:alertcancel];
-
-                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                                    [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-                                }
-                                else
-                                {
-                                    [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
-                                }
-
-                            }
-
-
-                        }
-                        else
-                        {
-
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
-                        }
-
-
-
-
-                    });
-                });
-
-
-            }
-            //            // [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(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
-            //
-            //                // alert.
-            //                [alert show];
-            //            }
-            //            else
-            //            {
-            //                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
-            //
-            //                // alert.
-            //                [alert show];
-            //            }
-        }
-        else
-        {
-
-            //            if(appDelegate.order_code==nil)
-            //                [ self neworder];
-            //            else
-            [holder performSelector:addtocart];
-
-
-
-        }
-    }
-
-}
-
-
-+(void) add_recent_model:(NSDictionary*) model
-{
-
-    NSMutableDictionary * newdict = [[NSMutableDictionary alloc]init];
-    [newdict setObject:model forKey:@"item_0"];
-
-
-
-
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    int count=[appDelegate.recent_model[@"count"] intValue];
-    for(int i=0;i<count;i++)
-    {
-        NSMutableDictionary * mitem= appDelegate.recent_model[[NSString stringWithFormat:@"item_%d",i]];
-        if([mitem[@"product_id"] isEqualToString:model[@"product_id"]])
-            continue;
-        [newdict setObject:mitem forKey:[NSString stringWithFormat:@"item_%lu",(unsigned long)newdict.allKeys.count]];
-
-    }
-    newdict[@"count"]=[NSString stringWithFormat:@"%lu",(unsigned long)newdict.allKeys.count];
-
-
-    appDelegate.recent_model = newdict;
-    //
-    //
-    //    if(!bexist)
-    //    {
-    //        [appDelegate.recent_model setObject:item forKey:[NSString stringWithFormat:@"item_%d",count]];
-    //        appDelegate.recent_model[@"count"]=[NSString stringWithFormat:@"%d",count+1];
-    //    }
-}
-@end

+ 0 - 15
RedAnt ERP Mobile/iSales-NPD/CategoryPriceCell.h

@@ -1,15 +0,0 @@
-//
-//  CategoryPriceCell.h
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface CategoryPriceCell : UITableViewCell
-
-@property (nonatomic,strong) NSDictionary *categoryPrice;
-
-@end

+ 0 - 73
RedAnt ERP Mobile/iSales-NPD/CategoryPriceCell.m

@@ -1,73 +0,0 @@
-//
-//  CategoryPriceCell.m
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "CategoryPriceCell.h"
-#import "SetCategoryPriceController.h"
-#import "config.h"
-
-@interface CategoryPriceCell ()
-
-@property (strong, nonatomic) IBOutlet UILabel *categoryLabel;
-
-@property (strong, nonatomic) IBOutlet UILabel *priceLabel;
-
-@end
-
-@implementation CategoryPriceCell
-
-- (void)awakeFromNib {
-    [super awakeFromNib];
-    // Initialization code
-}
-
-- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
-    [super setSelected:selected animated:animated];
-
-    // Configure the view for the selected state
-}
-
-- (void)setCategoryPrice:(NSDictionary *)categoryPrice {
-    _categoryPrice = categoryPrice;
-    
-    NSString *basePrice = [categoryPrice objectForKey:@"base_price"];
-    NSString *discount = [categoryPrice objectForKey:@"price_discount"];
-    NSString *price = @"";
-    switch (basePrice.integerValue) {
-        case 0:{
-            basePrice = [Singleton sharedInstance].deliveryString;
-        }
-            break;
-        case 1:{
-            basePrice = flat_price;
-        }
-            
-        default:
-            break;
-    }
-    
-    if ([discount hasPrefix:@"-"]) {
-        
-        discount = [discount substringFromIndex:1];
-        price = [NSString stringWithFormat:@"%@ - %@",basePrice,discount];
-        
-    } else if ([discount hasSuffix:@"%"]) {
-        
-        price = [NSString stringWithFormat:@"%@ x %@",basePrice,discount];
-        
-    } else {
-        
-        price = [NSString stringWithFormat:@"%@ + %@",basePrice,discount];
-        
-    }
-    
-    self.categoryLabel.text = [self.categoryPrice objectForKey:@"title"];
-    
-    self.priceLabel.text = price;
-}
-
-@end

+ 0 - 17
RedAnt ERP Mobile/iSales-NPD/CategoryPriceViewController.h

@@ -1,17 +0,0 @@
-//
-//  CategoryPriceViewController.h
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "SetCategoryPriceController.h"
-
-
-@interface CategoryPriceViewController : UIViewController
-
-@property (nonatomic,strong) NSMutableDictionary *categoryGivenPrice;
-
-@end

+ 0 - 143
RedAnt ERP Mobile/iSales-NPD/CategoryPriceViewController.m

@@ -1,143 +0,0 @@
-//
-//  CategoryPriceViewController.m
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "CategoryPriceViewController.h"
-#import "const.h"
-#import "CategoryPriceCell.h"
-#import "UIColor+JK_HEX.h"
-
-@interface CategoryPriceViewController ()<UITableViewDelegate,UITableViewDataSource>
-
-@property (strong, nonatomic) IBOutlet UITableView *categoryTable;
-
-@end
-
-@implementation CategoryPriceViewController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    
-    [self configAppearance];
-}
-
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-- (void)configAppearance {
-    
-    self.navigationController.navigationBar.translucent = NO;
-    
-    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
-                                                                   style:UIBarButtonItemStylePlain
-                                                                  target:self
-                                                                  action:@selector( returnBackClick:)];
-    
-    self.navigationItem.leftBarButtonItem = backButton;
-}
-
-#pragma mark - action
-
-- (void)returnBackClick:(id)sender {
-    
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
-#pragma mark - data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-    return [[self.categoryGivenPrice objectForKey:@"count"] integerValue];
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    NSString *sectionKey = [NSString stringWithFormat:@"category_%d",section];
-    return [[[self.categoryGivenPrice objectForKey:sectionKey] objectForKey:@"count"] integerValue];
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    
-    CategoryPriceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CategoryPriceCell"];
-    
-    // 解析数据
-    NSInteger section = indexPath.section;
-    NSInteger row = indexPath.row;
-    NSDictionary *categorySection = [self.categoryGivenPrice objectForKey:[NSString stringWithFormat:@"category_%d",section]];
-    NSDictionary *categoryRow = [categorySection objectForKey:[NSString stringWithFormat:@"category_%d",row]];
-
-    cell.categoryPrice = categoryRow;
-    
-    return cell;
-}
-
-#pragma mark - delegate
-
-- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-    return 47.0f;
-}
-
-- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
-    return 40.0f;
-}
-
-- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
-    
-    NSString *sectionKey = [NSString stringWithFormat:@"category_%d",section];
-    
-    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), 40)];
-    headerView.backgroundColor = [UIColor colorWithHEX:0xEFEAE5];
-    
-    UILabel *categoryLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 100, 20)];
-    categoryLabel.textColor = [UIColor blackColor];
-    categoryLabel.font = [UIFont systemFontOfSize:17.0f];
-    categoryLabel.textAlignment = NSTextAlignmentLeft;
-    categoryLabel.text = [[self.categoryGivenPrice objectForKey:sectionKey] objectForKey:@"title"];
-    
-    [headerView addSubview:categoryLabel];
-    
-    return headerView;
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    
-    CategoryPriceCell *cell = [tableView cellForRowAtIndexPath:indexPath];
-    
-    SetCategoryPriceController *setPriceVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"SetCategoryPriceController"];
-    
-    __weak typeof(self) weakself = self;
-    setPriceVC.returnBlock = ^(NSDictionary *result){
-        
-        
-        if (weakself) {
-            __strong typeof(weakself) strongself = weakself;
-            
-            NSInteger section = indexPath.section;
-            NSInteger row = indexPath.row;
-            NSDictionary *categorySection = [[self.categoryGivenPrice objectForKey:[NSString stringWithFormat:@"category_%d",section]] mutableCopy];
-            [categorySection setValue:result forKey:[NSString stringWithFormat:@"category_%d",row]];
-            
-            [strongself.categoryGivenPrice setObject:categorySection forKey:[NSString stringWithFormat:@"category_%d",section]];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                [strongself.categoryTable reloadData];
-            });
-            
-        }
-        
-        
-    };
-    setPriceVC.categoryID = [[cell.categoryPrice objectForKey:@"cid"] integerValue];
-    setPriceVC.categoryPrice = cell.categoryPrice.mutableCopy;
-    
-    [self.navigationController pushViewController:setPriceVC animated:YES];
-    
-}
-
-
-@end