Ray Zhang 10 жил өмнө
parent
commit
3c257157c3
33 өөрчлөгдсөн 1546 нэмэгдсэн , 786 устгасан
  1. 1 1
      RedAnt ERP Mobile/common/CommonEditor/CommonEditorCellImg.h
  2. 1 1
      RedAnt ERP Mobile/common/CommonEditor/CommonEditorCellImg.m
  3. 17 6
      RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m
  4. 54 3
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  5. 8 1
      RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m
  6. 1 1
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.h
  7. 163 58
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  8. 1 1
      RedAnt ERP Mobile/common/Functions/cart/EditModelPriceViewController.h
  9. 11 5
      RedAnt ERP Mobile/common/Functions/cart/EditModelPriceViewController.m
  10. 1 0
      RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.h
  11. 5 4
      RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.m
  12. 12 8
      RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.h
  13. 23 14
      RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m
  14. 16 3
      RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m
  15. 4 0
      RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.h
  16. 24 1
      RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m
  17. 10 0
      RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.h
  18. 522 220
      RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m
  19. 3 0
      RedAnt ERP Mobile/common/Functions/contact/customer_info_template.json
  20. 3 0
      RedAnt ERP Mobile/common/Functions/contact/customer_info_template_edit.json
  21. 19 12
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m
  22. 1 0
      RedAnt ERP Mobile/common/Functions/order/OrderDetailModelCell.h
  23. 14 0
      RedAnt ERP Mobile/common/Functions/order/OrderDetailSignatureCell.h
  24. 23 0
      RedAnt ERP Mobile/common/Functions/order/OrderDetailSignatureCell.m
  25. 366 388
      RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m
  26. 159 39
      RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m
  27. 17 3
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m
  28. 16 2
      RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m
  29. 16 2
      RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m
  30. 11 5
      RedAnt ERP Mobile/common/Functions/signature/SignatureView.m
  31. 16 3
      RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m
  32. 1 1
      RedAnt ERP Mobile/common/data_provider/iSalesNetwork.h
  33. 7 4
      RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

+ 1 - 1
RedAnt ERP Mobile/common/CommonEditor/CommonEditorCellImg.h

@@ -24,5 +24,5 @@
 @property bool editable;
 @property bool editable;
 @property bool img_validate;
 @property bool img_validate;
 @property bool isFullScreen;
 @property bool isFullScreen;
-@property (nonatomic , copy) void (^imgChanged)(NSString* url_down,NSString* url_up, int index);
+@property (nonatomic , copy) void (^imgChanged)(NSString* url_down,NSString* url_up, int index,NSString* url_index);
 @end
 @end

+ 1 - 1
RedAnt ERP Mobile/common/CommonEditor/CommonEditorCellImg.m

@@ -56,7 +56,7 @@
             touchImageView.image=img;
             touchImageView.image=img;
             
             
             if(self.imgChanged)
             if(self.imgChanged)
-                self.imgChanged(url_down,newurl,tag);
+                self.imgChanged(url_down,newurl,tag,url_up);
             
             
         };
         };
         
         

+ 17 - 6
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -2256,11 +2256,11 @@
             cell.labelTitle.text = title;
             cell.labelTitle.text = title;
             cell.labelDescription.text = value;
             cell.labelDescription.text = value;
             
             
-            cell.imgChanged = ^(NSString* url_down,NSString* url_up,int index )
+            cell.imgChanged = ^(NSString* url_down,NSString* url_up,int index ,NSString* url_index)
             {
             {
                 //            NSMutableDictionary* editjson = [item_json mutableCopy];
                 //            NSMutableDictionary* editjson = [item_json mutableCopy];
                 //            editjson[@"img_url"]=url;
                 //            editjson[@"img_url"]=url;
-                [self imgIsChanged:url_down url_up:url_up indexPath:indexPath index:index];
+                [self imgIsChanged:url_down url_up:url_up indexPath:indexPath index:index url_index:url_index];
                 
                 
                 
                 
             };
             };
@@ -2269,7 +2269,10 @@
                 NSString* img_url0 = [item_json valueForKey:@"img_url_0"];
                 NSString* img_url0 = [item_json valueForKey:@"img_url_0"];
                 if(img_url0.length>0)
                 if(img_url0.length>0)
                 {
                 {
-                    cell.imgs[0]=img_url0;
+                    NSString* img_url_up=[item_json valueForKey:@"img_url_aname_0"];
+                    if(img_url_up.length==0)
+                        img_url_up=@"";
+                    cell.imgs[0]=img_url_up;
                     NSString* file_name=[img_url0 lastPathComponent];
                     NSString* file_name=[img_url0 lastPathComponent];
                     NSData* img_data=[iSalesDB load_cached_img:file_name];
                     NSData* img_data=[iSalesDB load_cached_img:file_name];
                     if(img_data!=nil)
                     if(img_data!=nil)
@@ -2325,7 +2328,11 @@
                 NSString* img_url1 = [item_json valueForKey:@"img_url_1"];
                 NSString* img_url1 = [item_json valueForKey:@"img_url_1"];
                 if(img_url1.length>0)
                 if(img_url1.length>0)
                 {
                 {
-                    cell.imgs[1]=img_url1;
+                    NSString* img_url_up=[item_json valueForKey:@"img_url_aname_1"];
+                    if(img_url_up.length==0)
+                        img_url_up=@"";
+                    
+                    cell.imgs[1]=img_url_up;
                     NSString* file_name=[img_url1 lastPathComponent];
                     NSString* file_name=[img_url1 lastPathComponent];
                     NSData* img_data=[iSalesDB load_cached_img:file_name];
                     NSData* img_data=[iSalesDB load_cached_img:file_name];
                     if(img_data!=nil)
                     if(img_data!=nil)
@@ -2380,7 +2387,10 @@
                 NSString* img_url2 = [item_json valueForKey:@"img_url_2"];
                 NSString* img_url2 = [item_json valueForKey:@"img_url_2"];
                 if(img_url2.length>0)
                 if(img_url2.length>0)
                 {
                 {
-                    cell.imgs[2]=img_url2;
+                    NSString* img_url_up=[item_json valueForKey:@"img_url_aname_2"];
+                    if(img_url_up.length==0)
+                        img_url_up=@"";
+                    cell.imgs[2]=img_url_up;
                     NSString* file_name=[img_url2 lastPathComponent];
                     NSString* file_name=[img_url2 lastPathComponent];
                     NSData* img_data=[iSalesDB load_cached_img:file_name];
                     NSData* img_data=[iSalesDB load_cached_img:file_name];
                     if(img_data!=nil)
                     if(img_data!=nil)
@@ -4182,7 +4192,7 @@
 #pragma mark- img changed
 #pragma mark- img changed
 
 
 // image 改变时执行
 // image 改变时执行
-- (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath index:(int)index{
+- (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath index:(int)index url_index:(NSString* )url_index{
     // NSLog(@"Sender is = %@", url);
     // NSLog(@"Sender is = %@", url);
     
     
     
     
@@ -4205,6 +4215,7 @@
 //    imgs[index];
 //    imgs[index];
     item_json[ [NSString stringWithFormat:@"img_url_%d",index]]=url_down;
     item_json[ [NSString stringWithFormat:@"img_url_%d",index]]=url_down;
     item_json[@"avalue"]=url_up;
     item_json[@"avalue"]=url_up;
+    item_json[[NSString stringWithFormat:@"img_url_aname_%d",index]]=url_index;
     [item_json setValue:@"true" forKey:@"dirty"];
     [item_json setValue:@"true" forKey:@"dirty"];
     if(subid==nil)
     if(subid==nil)
     {
     {

+ 54 - 3
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -316,6 +316,10 @@
         
         
         ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
         ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
         cvc.update_order = true;
         cvc.update_order = true;
+        cvc.edit_icon = true;
+        cvc.assig_icon = true;
+        cvc.reset_icon = false;
+        
         cvc.showNavibar = true;
         cvc.showNavibar = true;
         cvc.contact_type = @"Sales_Order_Customer";
         cvc.contact_type = @"Sales_Order_Customer";
         cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
         cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
@@ -339,8 +343,22 @@
         
         
         vc.url_type = URL_LOCAL;
         vc.url_type = URL_LOCAL;
         
         
+      //  if(appDelegate.order_code.length>0)
+        {
+            vc.edit_icon = false;
+            vc.assig_icon = true;
+            vc.reset_icon = true;
         vc.request_url=LOCAL_URL_CUSTOMER_INFO_EDIT;
         vc.request_url=LOCAL_URL_CUSTOMER_INFO_EDIT;
-        
+        }
+//        else
+//        {
+//            vc.edit_icon = false;
+//            vc.assig_icon = false;
+//            vc.reset_icon = true;
+//            vc.request_url=LOCAL_URL_CUSTOMER_INFO_EDITOR;
+//        }
+        
+  //      NSDictionary* dd=appDelegate.customerInfo;;
         vc.data_init = appDelegate.customerInfo;
         vc.data_init = appDelegate.customerInfo;
         
         
         vc.update_order = true;
         vc.update_order = true;
@@ -394,6 +412,23 @@
     self.contactListViewController =[ self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController"];
     self.contactListViewController =[ self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController"];
     self.contactListViewController.contact_type = @"Sales_Order_Customer";
     self.contactListViewController.contact_type = @"Sales_Order_Customer";
     
     
+    self.contactListViewController.edit_icon = true;
+    self.contactListViewController.assig_icon = true;
+    self.contactListViewController.reset_icon = false;
+    self.contactListViewController.ui_type = CONTACT_LIST;
+    
+    self.contactListViewController.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
+        
+        appDelegate.contact_id=[value valueForKey:@"customer_cid"];
+        appDelegate.customerInfo = value;
+        
+        //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
+        
+        //
+        //                if(self.returnValue)
+        //                    self.returnValue(value);
+    };
+    
     
     
     self.orderViewController.selectOrder=^(NSMutableDictionary* order_detail){
     self.orderViewController.selectOrder=^(NSMutableDictionary* order_detail){
         //main view 下打开order
         //main view 下打开order
@@ -1046,7 +1081,15 @@
                     [self checklogin:false];
                     [self checklogin:false];
                     if(appDelegate.can_create_order)
                     if(appDelegate.can_create_order)
                     {
                     {
-                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch To Cart", nil) message:NSLocalizedString(@"Do you want to switch to a pending order or a new order", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to pending order", nil),NSLocalizedString(@"Switch to new order", nil), nil];
+                        
+                        NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                        if(appDelegate.contact_id.length>0)
+                        {
+                            msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+                            msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+                            
+                        }
+                        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch To Cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to pending order", nil),NSLocalizedString(@"Switch to new order", nil), nil];
                         
                         
                         
                         
                         
                         
@@ -1101,7 +1144,15 @@
             [self checklogin:false];
             [self checklogin:false];
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch to cart", nil) message:NSLocalizedString(@"Do you want to Switch to a pending order or a new order", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to pending order", nil),NSLocalizedString(@"Switch to new order", nil), nil];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                if(appDelegate.contact_id.length>0)
+                {
+                    msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+                    
+                }
+                
+                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Switch to pending order", nil),NSLocalizedString(@"Switch to new order", nil), nil];
                 
                 
                 // alert.
                 // alert.
                 [alert show];
                 [alert show];

+ 8 - 1
RedAnt ERP Mobile/common/Functions/camscan/ScannerViewController.m

@@ -512,7 +512,14 @@
             
             
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
                 [alert show];
                 [alert show];

+ 1 - 1
RedAnt ERP Mobile/common/Functions/cart/CartViewController.h

@@ -11,7 +11,7 @@
 #import "ModelItemCell.h"
 #import "ModelItemCell.h"
 #import "CommonEditorViewController.h"
 #import "CommonEditorViewController.h"
 #import "ActiveViewController.h"
 #import "ActiveViewController.h"
-@interface CartViewController : ActiveViewController <UITableViewDataSource,UITableViewDelegate,CommonEditorViewControllerDelegate/*,CommonGridViewControllerDelegate*/,ModelItemCellDelegate,UIAlertViewDelegate>
+@interface CartViewController : ActiveViewController <UITableViewDataSource,UITableViewDelegate,CommonEditorViewControllerDelegate/*,CommonGridViewControllerDelegate,ModelItemCellDelegate*/,UIAlertViewDelegate>
 @property (strong, nonatomic) IBOutlet UITableView *itemListTable;
 @property (strong, nonatomic) IBOutlet UITableView *itemListTable;
 @property (strong, nonatomic) IBOutlet UIView *cartItemView;
 @property (strong, nonatomic) IBOutlet UIView *cartItemView;
 //@property (strong, nonatomic) IBOutlet UIView *orderCreateView;
 //@property (strong, nonatomic) IBOutlet UIView *orderCreateView;

+ 163 - 58
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -328,13 +328,13 @@
 
 
 - (IBAction)onEditClick:(id)sender {
 - (IBAction)onEditClick:(id)sender {
     
     
-    //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //
-    //    [appDelegate test_onDecodedDataResult:@"371252"];
-    //
-    //
-    //    return;
-    
+//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    
+//        [appDelegate test_onDecodedDataResult:@"4400022"];
+//    
+//    
+//        return;
+//    
     
     
     [self begin_edit];
     [self begin_edit];
 }
 }
@@ -845,6 +845,8 @@
     self.total_carton=0;
     self.total_carton=0;
     self.total_cuft=0;
     self.total_cuft=0;
     self.total_weight=0;
     self.total_weight=0;
+    self.total_QTY=0;
+    self.total_item=0;
     
     
     long count =self.content_arr.count;//[[self.content_data valueForKey:@"count"] intValue];
     long count =self.content_arr.count;//[[self.content_data valueForKey:@"count"] intValue];
     for(int i=0;i<count;i++)
     for(int i=0;i<count;i++)
@@ -931,7 +933,7 @@
     self.label_weight.text=subweight;
     self.label_weight.text=subweight;
     self.label_items.text = subitems;
     self.label_items.text = subitems;
     self.label_qty.text = subqty;
     self.label_qty.text = subqty;
-    self.label_notes.text = self.notes;
+    self.label_notes.text = [self.notes stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
     
     
 }
 }
 - (IBAction)onEditGeneralNotes:(id)sender {
 - (IBAction)onEditGeneralNotes:(id)sender {
@@ -1067,27 +1069,27 @@
     //    NSLog(self.btnselect.titleLabel.text);
     //    NSLog(self.btnselect.titleLabel.text);
     //    if(self.btnselect.titleLabel.text)
     //    if(self.btnselect.titleLabel.text)
 }
 }
-#pragma mark - MODEL cell delegate
--(void) returnQTY:(int)qty indexPath :(NSIndexPath*) indexPath
-{
-    NSMutableDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
-    
-    int count=[[item_json valueForKey:@"count"] intValue];
-    
-    if(count==qty)
-        return;
-    [item_json setValue:[NSString stringWithFormat:@"%d",qty] forKey:@"count"];
-    double unit_price = [[item_json valueForKey:@"unit_price"] doubleValue];
-    //   double sub_total=[[item_json valueForKey:@"subtotal_price"] doubleValue];
-    [item_json setValue:[NSString stringWithFormat:@"%f",unit_price*qty] forKey:@"subtotal_price"];
-    self.content_arr[indexPath.row]= item_json;
-    //  [self.content_data setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
-    [self refresh_total];
-    //  self.total+=(unit_price*qty-sub_total);
-    //  self.labelTotal.text=[NSString stringWithFormat:@"$%.2f",self.total];
-    
-    
-}
+//#pragma mark - MODEL cell delegate
+//-(void) returnQTY:(int)qty
+//{
+//    NSMutableDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
+//    
+//    int count=[[item_json valueForKey:@"count"] intValue];
+//    
+//    if(count==qty)
+//        return;
+//    [item_json setValue:[NSString stringWithFormat:@"%d",qty] forKey:@"count"];
+//    double unit_price = [[item_json valueForKey:@"unit_price"] doubleValue];
+//    //   double sub_total=[[item_json valueForKey:@"subtotal_price"] doubleValue];
+//    [item_json setValue:[NSString stringWithFormat:@"%f",unit_price*qty] forKey:@"subtotal_price"];
+//    self.content_arr[indexPath.row]= item_json;
+//    //  [self.content_data setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
+//    [self refresh_total];
+//    //  self.total+=(unit_price*qty-sub_total);
+//    //  self.labelTotal.text=[NSString stringWithFormat:@"$%.2f",self.total];
+//    
+//    
+//}
 
 
 #pragma mark - commoneditor controller delegate
 #pragma mark - commoneditor controller delegate
 -(void) returnValue:(NSMutableDictionary *)value indexPath :(NSIndexPath*) indexPath
 -(void) returnValue:(NSMutableDictionary *)value indexPath :(NSIndexPath*) indexPath
@@ -1097,16 +1099,20 @@
     [[self navigationController] setNavigationBarHidden:YES animated:NO];
     [[self navigationController] setNavigationBarHidden:YES animated:NO];
 }
 }
 #pragma mark - Table view data source
 #pragma mark - Table view data source
-//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
-//{
-//     NSDictionary * item_json = [self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
-//    if([item_json objectForKey:@"combine"] == nil)
-//    {
-//        return 120;
-//    }
-//    else
-//        return 150;
-//}
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
+{
+    NSMutableDictionary * item_json = [self.content_arr[indexPath.row ] mutableCopy];// [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
+    
+    NSString* notes =[item_json valueForKey:@"note"];
+    if(notes.length>0)
+    {
+        return 146;
+    }
+    else
+        return 120;
+    
+
+}
 
 
 //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
 //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
 //{
 //{
@@ -1175,6 +1181,7 @@
     
     
     UILabel *contactlabel = [[UILabel alloc] initWithFrame:CGRectMake(320, 5.5, 90, 22)];
     UILabel *contactlabel = [[UILabel alloc] initWithFrame:CGRectMake(320, 5.5, 90, 22)];
     contactlabel.textColor=[UIColor whiteColor];
     contactlabel.textColor=[UIColor whiteColor];
+    contactlabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
     contactlabel.backgroundColor = [UIColor clearColor];
     contactlabel.backgroundColor = [UIColor clearColor];
     contactlabel.text=NSLocalizedString(@"Unit price", nil);
     contactlabel.text=NSLocalizedString(@"Unit price", nil);
     [contactlabel sizeToFit];
     [contactlabel sizeToFit];
@@ -1183,6 +1190,7 @@
     
     
     UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(470, 5.5, 90, 22)];
     UILabel *modellabel = [[UILabel alloc] initWithFrame:CGRectMake(470, 5.5, 90, 22)];
     modellabel.textColor=[UIColor whiteColor];
     modellabel.textColor=[UIColor whiteColor];
+     modellabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
     modellabel.backgroundColor = [UIColor clearColor];
     modellabel.backgroundColor = [UIColor clearColor];
     modellabel.text=NSLocalizedString(@"Discount/QTY", nil);
     modellabel.text=NSLocalizedString(@"Discount/QTY", nil);
     [modellabel sizeToFit];
     [modellabel sizeToFit];
@@ -1190,6 +1198,7 @@
     
     
     UILabel *pricelabel = [[UILabel alloc] initWithFrame:CGRectMake(640, 5.5, 90, 22)];
     UILabel *pricelabel = [[UILabel alloc] initWithFrame:CGRectMake(640, 5.5, 90, 22)];
     pricelabel.textColor=[UIColor whiteColor];
     pricelabel.textColor=[UIColor whiteColor];
+    pricelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
     pricelabel.backgroundColor = [UIColor clearColor];
     pricelabel.backgroundColor = [UIColor clearColor];
     pricelabel.text=NSLocalizedString(@"Set/Subtotal", nil);
     pricelabel.text=NSLocalizedString(@"Set/Subtotal", nil);
     [pricelabel sizeToFit];
     [pricelabel sizeToFit];
@@ -1227,7 +1236,10 @@
     NSDictionary * item_json = self.content_arr[indexPath.row];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
     NSDictionary * item_json = self.content_arr[indexPath.row];//[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
     NSDictionary * combine_json =[item_json objectForKey:@"combine"];
     NSDictionary * combine_json =[item_json objectForKey:@"combine"];
     bool isfree = [[item_json valueForKey:@"is_free"]boolValue];
     bool isfree = [[item_json valueForKey:@"is_free"]boolValue];
+    NSString* notes = [item_json valueForKey:@"note"];
     
     
+    bool noprice =[[item_json valueForKey:@"is_no_price"]boolValue];
+    cell.noprice = noprice;
     cell.enable_longpress = true;
     cell.enable_longpress = true;
     cell.bundle_item=combine_json;
     cell.bundle_item=combine_json;
     NSString* img_url = [item_json valueForKey:@"img_url"];
     NSString* img_url = [item_json valueForKey:@"img_url"];
@@ -1248,8 +1260,12 @@
     //    discount = 5.0;
     //    discount = 5.0;
     cell.discount = discount;
     cell.discount = discount;
     
     
-    
-    
+    if(notes.length>0)
+    {
+        cell.labelNotes.text = [@"Note: " stringByAppendingString:[notes stringByReplacingOccurrencesOfString:@"\n" withString:@" "]];
+    }
+    else
+        cell.labelNotes.text = nil;
     
     
     NSString* discountstr=[NSString stringWithFormat:@"%@%% off", [RAUtils FloatFormat:discount]];
     NSString* discountstr=[NSString stringWithFormat:@"%@%% off", [RAUtils FloatFormat:discount]];
     
     
@@ -1278,9 +1294,24 @@
             cell.labelDiscount.hidden = false;
             cell.labelDiscount.hidden = false;
         }
         }
     }
     }
-    
-    cell.delegate=self;
-    cell.from=indexPath;
+    cell.onReturnQTY=^(int qty)
+    {
+        NSMutableDictionary * item_json = [self.content_arr[indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
+        
+        int count=[[item_json valueForKey:@"count"] intValue];
+        
+        if(count==qty)
+            return;
+        [item_json setValue:[NSString stringWithFormat:@"%d",qty] forKey:@"count"];
+        double unit_price = [[item_json valueForKey:@"unit_price"] doubleValue];
+        //   double sub_total=[[item_json valueForKey:@"subtotal_price"] doubleValue];
+        [item_json setValue:[NSString stringWithFormat:@"%f",unit_price*qty] forKey:@"subtotal_price"];
+        self.content_arr[indexPath.row]= item_json;
+        //  [self.content_data setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
+        [self refresh_total];
+    };
+ //   cell.delegate=self;
+ //   cell.from=indexPath;
     cell.unit_price = unitprice;
     cell.unit_price = unitprice;
     //    cell.labelAttribute.text = attribute;
     //    cell.labelAttribute.text = attribute;
     //    cell.labelCurrency.text = currency;
     //    cell.labelCurrency.text = currency;
@@ -1308,10 +1339,19 @@
     
     
     cell.labelDescription.text = description;
     cell.labelDescription.text = description;
     //   cell.labelIdentifier.text = identifier;
     //   cell.labelIdentifier.text = identifier;
-    cell.labelPrice.text = newprice;
-    
-    cell.labelUnitPrice.text = newunitprice;
     
     
+    if(noprice&&unitprice==0.0)
+    {
+        cell.labelPrice.text = @"No Price";
+        
+        cell.labelUnitPrice.text = @"No Price";
+    }
+    else
+    {
+        cell.labelPrice.text = newprice;
+        
+        cell.labelUnitPrice.text = newunitprice;
+    }
     bool check = [[item_json valueForKey:@"check"] boolValue];
     bool check = [[item_json valueForKey:@"check"] boolValue];
     if(check)
     if(check)
     {
     {
@@ -1524,7 +1564,7 @@
         
         
         NSLog(@"delete click");
         NSLog(@"delete click");
         
         
-        
+         //[self.itemListTable setEditing:false animated:YES];
         
         
         UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from cart?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
         UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure remove model from cart?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
         alert.tag = ALERT_DEL;
         alert.tag = ALERT_DEL;
@@ -1636,8 +1676,68 @@
         vc.cart_id = [NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
         vc.cart_id = [NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
         //    vc.delegate = parentvc.self;
         //    vc.delegate = parentvc.self;
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-        vc.onSetValue = ^(){
-            [self reload_data];//[main_vc checklogin:true];
+        vc.onSetValue = ^(double price,double discount){
+            
+            bool bmodify=false;
+            if(price!= [[item_json valueForKey:@"unit_price"] floatValue])
+                bmodify=true;
+            
+            NSString* notes = [item_json valueForKey:@"note"];
+            if(notes.length==0)
+                notes=@"";
+            if(bmodify)
+            {
+                if([notes isEqualToString:@""])
+                    notes=@"PRICE MODIFIED";
+
+                NSRange range;
+                range = [notes rangeOfString:@"PRICE MODIFIED"];
+                if (range.location != NSNotFound) {
+                    
+                }else{
+                   notes= [notes stringByAppendingString:@"\nPRICE MODIFIED"];
+                }
+            }
+            
+            
+            
+            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            
+                
+                UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Update Price"];
+                NSDictionary* cart_json = nil;
+                
+                cart_json = [iSalesNetwork cart_setPrice:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]] price:price discount:discount notes:notes];
+                
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    
+                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                    
+                    if([[cart_json valueForKey:@"result"] intValue]==2)
+                    {
+                        [item_json setValue:[NSNumber numberWithDouble:price ] forKey:@"unit_price"];
+                        
+                        [item_json setValue:[NSNumber numberWithDouble:discount ] forKey:@"discount"];
+                         [item_json setValue:notes forKey:@"note"];
+                        self.content_arr[indexPath.row ] = item_json;
+                        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+                    }
+                    else
+                    {
+                        [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Update Price" controller:self] ;
+                    }
+                    
+                    
+                    
+                    
+                });
+            });
+
+            
+
+
+            
+          //  [self reload_data];//[main_vc checklogin:true];
         };
         };
         
         
         
         
@@ -1659,8 +1759,8 @@
             //   self.btop = false;
             //   self.btop = false;
             //  <#code#>
             //  <#code#>
         }];
         }];
-        
-        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+        // [self.itemListTable setEditing:false animated:YES];
+        //[tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
         
         
         
         
     }];
     }];
@@ -1748,9 +1848,13 @@
         NSMutableDictionary * item_json = [self.content_arr[indexPath.row ] mutableCopy];// [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
         NSMutableDictionary * item_json = [self.content_arr[indexPath.row ] mutableCopy];// [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
         
         
         
         
+        vc.onSaveNote=^(NSString* notes){
+            [item_json setValue:notes forKey:@"note"];
+            self.content_arr[indexPath.row ] = item_json;
+                    [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+        };
         
         
-        
-        vc.notes=[item_json valueForKey:@"notes"];
+        vc.notes=[item_json valueForKey:@"note"];
         vc.cart_id = [NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
         vc.cart_id = [NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
         //    vc.delegate = parentvc.self;
         //    vc.delegate = parentvc.self;
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
@@ -1777,8 +1881,8 @@
             //   self.btop = false;
             //   self.btop = false;
             //  <#code#>
             //  <#code#>
         }];
         }];
-        
-        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+        //    [self.itemListTable setEditing:false animated:YES];
+       // [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
         
         
 
 
 
 
@@ -1864,7 +1968,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     {
     {
         if(buttonIndex!=alertView.cancelButtonIndex)
         if(buttonIndex!=alertView.cancelButtonIndex)
         {
         {
-            [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+           // [self.itemListTable reloadRowsAtIndexPaths:@[self.indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
             NSMutableDictionary * item_json = [self.content_arr[self.indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
             NSMutableDictionary * item_json = [self.content_arr[self.indexPath.row] mutableCopy];//[[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)self.indexPath.row]] mutableCopy];
             
             
             NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
             NSString *ids=[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"cart_item_id"] intValue]];
@@ -1888,13 +1992,14 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                             if([_id isEqualToString:ids])
                             if([_id isEqualToString:ids])
                             {
                             {
                                 [self.content_arr removeObjectAtIndex:i];
                                 [self.content_arr removeObjectAtIndex:i];
-                                [self.itemListTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.indexPath] withRowAnimation:UITableViewRowAnimationLeft];
+                              //  [self.itemListTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.indexPath] withRowAnimation:UITableViewRowAnimationLeft];
                                 break;
                                 break;
                                 // appDelegate.cart_count--;
                                 // appDelegate.cart_count--;
                                 // [appDelegate update_count_mark];
                                 // [appDelegate update_count_mark];
                             }
                             }
                             
                             
                         }
                         }
+                        [self.itemListTable reloadData];
                         [self refresh_total];
                         [self refresh_total];
                         //                        [self reload_data];
                         //                        [self reload_data];
                     }
                     }

+ 1 - 1
RedAnt ERP Mobile/common/Functions/cart/EditModelPriceViewController.h

@@ -24,6 +24,6 @@
 
 
 @property bool hide_discount;
 @property bool hide_discount;
 
 
-@property (nonatomic , copy) void (^onSetValue)();
+@property (nonatomic , copy) void (^onSetValue)(double price,double discount);
 @property bool set_watch_list;
 @property bool set_watch_list;
 @end
 @end

+ 11 - 5
RedAnt ERP Mobile/common/Functions/cart/EditModelPriceViewController.m

@@ -82,8 +82,14 @@
     [self update_newprice];
     [self update_newprice];
     
     
     
     
-    
-    
+
+    [self dismissViewControllerAnimated:NO
+                             completion:^{
+                                 if(self.onSetValue)
+                                     self.onSetValue( self.price,self.discount);
+                                 
+                             }];
+    /*
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         
         NSDictionary* cart_json = nil;
         NSDictionary* cart_json = nil;
@@ -101,9 +107,7 @@
             {
             {
                 [self dismissViewControllerAnimated:NO
                 [self dismissViewControllerAnimated:NO
                                          completion:^{
                                          completion:^{
-                                             if(self.onSetValue)
-                         
-                                                 self.onSetValue();
+
                                              
                                              
                                          }];
                                          }];
             }
             }
@@ -117,6 +121,8 @@
             
             
         });
         });
     });
     });
+     
+     */
 }
 }
 #pragma mark textField delegate
 #pragma mark textField delegate
 - (BOOL)textFieldShouldReturn:(UITextField *)textField {
 - (BOOL)textFieldShouldReturn:(UITextField *)textField {

+ 1 - 0
RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.h

@@ -12,4 +12,5 @@
 @property (strong, nonatomic) IBOutlet UITextView *tv_notes;
 @property (strong, nonatomic) IBOutlet UITextView *tv_notes;
 @property (strong,nonatomic) NSString* cart_id;
 @property (strong,nonatomic) NSString* cart_id;
 @property (strong,nonatomic) NSString* notes;
 @property (strong,nonatomic) NSString* notes;
+@property (nonatomic , copy) void (^onSaveNote)(NSString* note);
 @end
 @end

+ 5 - 4
RedAnt ERP Mobile/common/Functions/cart/ItemNotesViewController.m

@@ -39,8 +39,9 @@
     
     
     
     
 
 
-   // [self.tv_notes endEditing:true];
+    [self.tv_notes endEditing:true];
     
     
+    self.notes = self.tv_notes.text;
     
     
     UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update Item Notes"];
     UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update Item Notes"];
     
     
@@ -60,9 +61,9 @@
             {
             {
                 [self dismissViewControllerAnimated:NO
                 [self dismissViewControllerAnimated:NO
                                          completion:^{
                                          completion:^{
-//                                             if(self.onSetValue)
-//                                                 
-//                                                 self.onSetValue();
+                                             if(self.onSaveNote)
+                                                 
+                                                 self.onSaveNote(self.notes);
                                              
                                              
                                          }];
                                          }];
             }
             }

+ 12 - 8
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.h

@@ -11,14 +11,14 @@
 #import "StrikethroughLabel.h"
 #import "StrikethroughLabel.h"
 
 
 @class ModelItemCell;
 @class ModelItemCell;
-@protocol ModelItemCellDelegate <NSObject>
-
--(void) returnQTY:(int)qty indexPath :(NSIndexPath*) indexPath;
-
-@end
+//@protocol ModelItemCellDelegate <NSObject>
+//
+//-(void) returnQTY:(int)qty ;//indexPath :(NSIndexPath*) indexPath;
+//
+//@end
 @interface ModelItemCell : UITableViewCell
 @interface ModelItemCell : UITableViewCell
 
 
-@property (nonatomic, weak) id<ModelItemCellDelegate> delegate;
+//@property (nonatomic, weak) id<ModelItemCellDelegate> delegate;
 
 
 
 
 @property (strong, nonatomic) IBOutlet UILabel *labelDescription;
 @property (strong, nonatomic) IBOutlet UILabel *labelDescription;
@@ -43,13 +43,17 @@
 @property (strong, nonatomic) IBOutlet UILabel *labelDiscount;
 @property (strong, nonatomic) IBOutlet UILabel *labelDiscount;
 @property (strong, nonatomic) IBOutlet UILabel *labelMasterpack;
 @property (strong, nonatomic) IBOutlet UILabel *labelMasterpack;
 
 
-@property (strong,nonatomic) NSIndexPath* from;
+//@property (strong,nonatomic) NSIndexPath* from;
+@property (strong, nonatomic) IBOutlet UILabel *labelNotes;
 
 
 
 
 @property bool enable_longpress;
 @property bool enable_longpress;
-
+@property bool noprice;
 @property (strong, nonatomic) IBOutlet UIImageView *img_checkmark;
 @property (strong, nonatomic) IBOutlet UIImageView *img_checkmark;
 
 
+
+@property (nonatomic , copy) void (^onReturnQTY)(int qty);
+
 //@property int step;
 //@property int step;
 //@property int quantity;
 //@property int quantity;
 @end
 @end

+ 23 - 14
RedAnt ERP Mobile/common/Functions/cart/ModelItemCell.m

@@ -67,9 +67,12 @@
                 
                 
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 {
                 {
-                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:indexPath:)]) {
-                        [self.delegate returnQTY:sender.value indexPath:self.from];
-                    }
+                    if(self.onReturnQTY)
+                        self.onReturnQTY(sender.value);
+//                    
+//                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
+//                        [self.delegate returnQTY:sender.value ];
+                   // }
                 }
                 }
                 else
                 else
                 {
                 {
@@ -97,9 +100,8 @@
                 
                 
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 {
                 {
-                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:indexPath:)]) {
-                        [self.delegate returnQTY:sender.value indexPath:self.from];
-                    }
+                    if(self.onReturnQTY)
+                        self.onReturnQTY(sender.value);
                 }
                 }
                 else
                 else
                 {
                 {
@@ -122,9 +124,11 @@
                 
                 
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 if([[cart_json valueForKey:@"result"] intValue]==2)
                 {
                 {
-                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:indexPath:)]) {
-                        [self.delegate returnQTY:sender.value indexPath:self.from];
-                    }
+                    if(self.onReturnQTY)
+                        self.onReturnQTY(sender.value);
+//                    if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
+//                        [self.delegate returnQTY:sender.value ];
+//                    }
                 }
                 }
                 else
                 else
                 {
                 {
@@ -209,8 +213,10 @@
     }
     }
     
     
 
 
-    
-    self.labelPrice.text =price;
+    if(self.noprice&&self.unit_price==0.0)
+        self.labelPrice.text =@"No Price";
+    else
+        self.labelPrice.text =price;
     
     
     self.editCount.text =[NSString stringWithFormat:@"%d",count];
     self.editCount.text =[NSString stringWithFormat:@"%d",count];
 }
 }
@@ -311,9 +317,12 @@
             
             
             if([[cart_json valueForKey:@"result"] intValue]==2)
             if([[cart_json valueForKey:@"result"] intValue]==2)
             {
             {
-                if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:indexPath:)]) {
-                    [self.delegate returnQTY:qty indexPath:self.from];
-                }
+//                if (self.delegate && [self.delegate respondsToSelector:@selector(returnQTY:)]) {
+//                    [self.delegate returnQTY:qty];
+//                }
+                
+                if(self.onReturnQTY)
+                    self.onReturnQTY(qty);
             }
             }
             else
             else
             {
             {

+ 16 - 3
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -220,8 +220,14 @@
                     [main_vc checklogin:false];
                     [main_vc checklogin:false];
                     if(appDelegate.can_create_order)
                     if(appDelegate.can_create_order)
                     {
                     {
-                    
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                        NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                        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];
                     
                     
                     
                     
                     
                     
@@ -277,7 +283,14 @@
             
             
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
             [alert show];
             [alert show];

+ 4 - 0
RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.h

@@ -34,4 +34,8 @@
 @property (strong,nonatomic) NSMutableDictionary* adv_search;
 @property (strong,nonatomic) NSMutableDictionary* adv_search;
 
 
 @property (strong, nonatomic) IBOutlet UILabel *label_net_err;
 @property (strong, nonatomic) IBOutlet UILabel *label_net_err;
+@property bool edit_icon;
+@property bool assig_icon;
+@property bool reset_icon;
+@property int ui_type;
 @end
 @end

+ 24 - 1
RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m

@@ -24,6 +24,12 @@
 @end
 @end
 
 
 @implementation ContactListViewController
 @implementation ContactListViewController
+
+- (void)awakeFromNib {
+    self.edit_icon = true;
+    self.assig_icon = true;
+    self.reset_icon=false;
+}
 -(void) logout
 -(void) logout
 {
 {
     self.offset = 0;
     self.offset = 0;
@@ -646,6 +652,9 @@ self.label_net_err.hidden=true;
     
     
     
     
     NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
     NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
+    
+    
+    bool editable =[[self.content_data[indexPath.row] valueForKey:@"can_update"]boolValue] ;
    
    
     CustomerInfoViewController * vc =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerInfoViewController"];
     CustomerInfoViewController * vc =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerInfoViewController"];
     
     
@@ -654,7 +663,21 @@ self.label_net_err.hidden=true;
     vc.request_url=LOCAL_URL_CUSTOMER_INFO_EDITOR;
     vc.request_url=LOCAL_URL_CUSTOMER_INFO_EDITOR;
     
     
     vc.update_order = self.update_order;
     vc.update_order = self.update_order;
-    
+            AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(self.ui_type==CONTACT_LIST)
+    {
+
+        vc.edit_icon = self.edit_icon&&editable&&appDelegate.can_update_contact_info;
+        vc.assig_icon = self.assig_icon&&(appDelegate.contact_id.length==0);
+        vc.reset_icon = self.reset_icon&&(appDelegate.contact_id.length!=0);
+    }
+    else
+    {
+        vc.edit_icon = self.edit_icon&&editable&&appDelegate.can_update_contact_info;
+        vc.assig_icon = self.assig_icon;
+        vc.reset_icon = self.reset_icon;
+    }
+
     
     
 //    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
 //    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
 //    //            NSString * string = [checked componentsJoinedByString:@","];
 //    //            NSString * string = [checked componentsJoinedByString:@","];

+ 10 - 0
RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.h

@@ -18,6 +18,16 @@
 @property (strong,nonatomic) NSString* rightbtn_title;
 @property (strong,nonatomic) NSString* rightbtn_title;
 @property (strong, nonatomic) IBOutlet UIBarButtonItem *right_btn;
 @property (strong, nonatomic) IBOutlet UIBarButtonItem *right_btn;
 @property bool update_order;
 @property bool update_order;
+
 @property (strong, nonatomic) IBOutlet UIBarButtonItem *btn_edit;
 @property (strong, nonatomic) IBOutlet UIBarButtonItem *btn_edit;
+@property (strong, nonatomic) IBOutlet UIBarButtonItem *btn_assign;
+@property (strong, nonatomic) IBOutlet UIBarButtonItem *btn_reset;
+
+
+@property (nonatomic , copy) void (^onClose)(NSMutableDictionary* value);
 
 
+@property bool edit_icon;
+@property bool assig_icon;
+@property bool reset_icon;
+//@property bool editable;
 @end
 @end

+ 522 - 220
RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m

@@ -9,141 +9,22 @@
 #import "CustomerInfoViewController.h"
 #import "CustomerInfoViewController.h"
 #import "iSalesNetwork.h"
 #import "iSalesNetwork.h"
 #import "CustomerEditViewController.h"
 #import "CustomerEditViewController.h"
-
+#import "MainViewController.h"
 @interface CustomerInfoViewController ()
 @interface CustomerInfoViewController ()
 
 
 @end
 @end
 
 
 @implementation CustomerInfoViewController
 @implementation CustomerInfoViewController
 
 
-- (void)viewDidLoad {
-    [super viewDidLoad];
-        [[self navigationController] setNavigationBarHidden:NO animated:NO];
-    
-    
-    if(self.rightbtn_title!=nil)
-      [ self.right_btn setTitle:self.rightbtn_title];
-    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onBackClick:)];
-    //    closeButton.title = @"Close";
-    
-    self.navigationItem.leftBarButtonItem = backButton;
-    
-    
-    
-//    UIBarButtonItem *backButton =self.navigationItem.leftBarButtonItem;
-//    
-//    NSLog(backButton.title);
-//    
-//    [backButton  setTitle:@"abcde"];
-//    
-//    self.navigationItem.leftBarButtonItem = backButton;
-    
-    if (self.data_init==nil) {
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            NSDictionary* editor_json = [iSalesNetwork request_CustomerInfo:self.contactId];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                
-                
-                
-                if([[editor_json valueForKey:@"result"] intValue]==2)
-                {
-                    self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
-                    
-                    [self fillData];
 
 
-                    
-                }
-                else
-                {
-                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
-                }
-                
-                
-            });
-        });
-    }
-    else
-    {
-        [self fillData];
-    }
-    
 
 
-    
-    
-    // Do any additional setup after loading the view.
-}
-- (void)onBackClick:(UIButton *)sender {
-    
-    
-    [self.navigationController popViewControllerAnimated:(false)];
-    //    [self.navigationController dismissViewControllerAnimated:true completion:^{
-    //        ;
-    //    }];
-}
-- (void) fillData
-{
-    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
-    
-    
-//    NSDictionary* data = [self.data_init objectForKey:@"customerInfo"];
-    for(int i=0;i<section_count;i++)
-    {
-        NSMutableDictionary * sectionjson= [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] mutableCopy];
-        int count = [[sectionjson valueForKey:@"count"] intValue];
-        for(int j=0;j<count;j++)
-        {
-            NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]] mutableCopy];
-            
-            NSString* control=[itemjson valueForKey:@"control"];
-            
-            NSString* name = [itemjson valueForKey:@"name"];
-            
-            NSString* value = [self.data_init valueForKey:name];
-            
-            [itemjson setValue:value forKey:@"value"];
-            
-            if([control isEqualToString:@"img"])
-            {
-                {
-                    NSString* img_url = [itemjson valueForKey:@"img_url_0"];
-                    
-                    NSString* url_value = [self.data_init valueForKey:img_url];
-                    [itemjson setValue:url_value forKey:@"img_url_0"];
-                }
-                {
-                    NSString* img_url = [itemjson valueForKey:@"img_url_1"];
-                    
-                    NSString* url_value = [self.data_init valueForKey:img_url];
-                    [itemjson setValue:url_value forKey:@"img_url_1"];
-                }
-                {
-                    NSString* img_url = [itemjson valueForKey:@"img_url_2"];
-                    
-                    NSString* url_value = [self.data_init valueForKey:img_url];
-                    [itemjson setValue:url_value forKey:@"img_url_2"];
-                }
-            }
-            
-            [sectionjson setObject:itemjson forKey:[NSString stringWithFormat:@"item_%d",j]];
-            
-            
-        }
-        [self.content_data_download setObject:sectionjson forKey:[NSString stringWithFormat:@"section_%d",i]];
-    }
-    self.content_data_control=[self translate_json:self.content_data_download changed:self.changed_data];
-    
-//    self.navigationItem.title =  [self.content_data_download valueForKey:@"title"] ;
-    [self.editorTable reloadData];
-}
-- (IBAction)onEditClick:(id)sender {
+- (void)onEditClick:(id)sender {
     
     
     
     
     NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
     NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
     
     
     
     
-    [params setValue:self.contactId forKey:@"contactId"];
+    [params setValue:self.contactId forKey:@"contact_id"];
     CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
     CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
     
     
     cuseditVC.bnewcustomer=false;
     cuseditVC.bnewcustomer=false;
@@ -153,27 +34,24 @@
     cuseditVC.params = params;
     cuseditVC.params = params;
     
     
     cuseditVC.delegate=self;
     cuseditVC.delegate=self;
-    //
-    //    if(checked.count==count)
-    //    {
-    //    orderinfoVC.have_tail = true
-    //    }
+
+    
     [[self navigationController] setNavigationBarHidden:NO animated:NO];
     [[self navigationController] setNavigationBarHidden:NO animated:NO];
     [self.navigationController pushViewController:cuseditVC animated:false];
     [self.navigationController pushViewController:cuseditVC animated:false];
-
-}
-- (IBAction)onSetClick:(id)sender {
     
     
-        [self.lastedit endEditing:true];
+}
+
+- (void)onAssignClick:(id)sender {
+    [self.lastedit endEditing:true];
     [self.lasttextview endEditing:true];
     [self.lasttextview endEditing:true];
     
     
     
     
     
     
     
     
     
     
-   // [self.navigationController popViewControllerAnimated:(false)];
+    // [self.navigationController popViewControllerAnimated:(false)];
     int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
     int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
-//    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
+    //    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
     
     
     for(int i=0;i<section_count;i++)
     for(int i=0;i<section_count;i++)
     {
     {
@@ -207,7 +85,7 @@
     [self.data_init setValue:customer_contact forKey:@"customer_contact"];
     [self.data_init setValue:customer_contact forKey:@"customer_contact"];
     //---------------- finish construct customer_contact----------------------
     //---------------- finish construct customer_contact----------------------
     
     
-        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if(self.update_order && appDelegate.order_code!=nil)
     if(self.update_order && appDelegate.order_code!=nil)
     {
     {
         
         
@@ -226,7 +104,7 @@
                     [self.navigationController popViewControllerAnimated:false];
                     [self.navigationController popViewControllerAnimated:false];
                     if(self.returnValue)
                     if(self.returnValue)
                     {
                     {
-
+                        
                         self.returnValue(self.data_init);
                         self.returnValue(self.data_init);
                     }
                     }
                     
                     
@@ -238,7 +116,7 @@
                     [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
                     [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
                 }
                 }
                 
                 
-
+                
                 
                 
             });
             });
         });
         });
@@ -252,37 +130,461 @@
         if(self.returnValue)
         if(self.returnValue)
         {
         {
             self.returnValue(self.data_init);
             self.returnValue(self.data_init);
-        
+            
         }
         }
-        //    [self.data_init setObject:data forKey:@"customerInfo"];
         
         
+    }
+    
+    
+}
+
+- (void)onResetClick:(id)sender {
+    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    if(appDelegate.order_code.length>0)
+    {
+        //当前已打开订单则关闭订单。
+        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to release order and reset contact?" message:nil preferredStyle:UIAlertControllerStyleAlert];
+        //block代码块取代了delegate
+        
+        
+        
+        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+            UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Release Order"];
+            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+                
+                NSDictionary* order_json = [iSalesNetwork release_Order:appDelegate.order_code];
+                
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                    if([[order_json valueForKey:@"result"] intValue]==2)
+                    {
+                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                        //                    appDelegate.order_code = nil;
+                        [appDelegate closeOrder];
+                        
+                        [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
+                        [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
+                       
+                        [self.navigationController popToRootViewControllerAnimated:false];
+                        
+                        
+
+                    }
+                    else
+                    {
+                        [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:self] ;
+                    }
+                    
+                    
+                    
+                });
+            });
+            
+        }];
+        
+        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+            NSLog(@"Cancel");
+        }];
+        [alertControl addAction:actionOne];
+        
+        [alertControl addAction:alertthree];
+ 
+        
+        
+        [self presentViewController:alertControl animated:YES completion:nil];
+  
         
         
-        /*
-         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-         appDelegate.contact_id=self.contactId;
-         appDelegate.customerInfo = self.data_init;
-         */
         
         
-//        [self.navigationController popToRootViewControllerAnimated:false];
     }
     }
+    else
+    {
+        //询问并清空当前的全局contact_id、customer
+        
+        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to reset contact?" message:nil preferredStyle:UIAlertControllerStyleAlert];
+        
+        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+          
+            appDelegate.contact_id=nil;
+            appDelegate.customerInfo = nil;
 
 
+            
+            [self.navigationController popViewControllerAnimated:(false)];
 
 
+        }];
+        
+        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+            NSLog(@"Cancel");
+        }];
+        [alertControl addAction:actionOne];
+        
+        [alertControl addAction:alertthree];
+        
+        
+        
+        [self presentViewController:alertControl animated:YES completion:nil];
+        
+    }
+    
+}
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    [[self navigationController] setNavigationBarHidden:NO animated:NO];
+    
+    
+    if(self.rightbtn_title!=nil)
+        [ self.right_btn setTitle:self.rightbtn_title];
+    //    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onBackClick:)];
+    //    //    closeButton.title = @"Close";
+    
+    
+    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
+                                                                   style:UIBarButtonItemStylePlain
+                                                                  target:self
+                                                                  action:@selector( onBackClick:)];
+    
+    self.navigationItem.leftBarButtonItem = backButton;
+    
+    
+    NSMutableArray * items = [[NSMutableArray alloc]init];
+    self.btn_edit = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                     style:UIBarButtonItemStylePlain
+                                                    target:self
+                                                    action:@selector(onEditClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
+    
+    
+    self.btn_edit.tintColor = UIColorFromRGB(0x996633);
+    
+    
+    
+    self.btn_assign = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"assign"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                       style:UIBarButtonItemStylePlain
+                                                      target:self
+                                                      action:@selector(onAssignClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
+    
+    
+    self.btn_assign.tintColor = UIColorFromRGB(0x996633);
+    
+    
+    self.btn_reset = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"reset"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
+                                                      style:UIBarButtonItemStylePlain
+                                                     target:self
+                                                     action:@selector(onResetClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
+    
+    
+    self.btn_reset.tintColor = UIColorFromRGB(0x996633);
+    
+//     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    if(self.edit_icon)
+        [items addObject:self.btn_edit];
+    if(self.assig_icon)
+        [items addObject:self.btn_assign];
+    if(self.reset_icon)
+        [items addObject:self.btn_reset];
+    
+    self.navigationItem.rightBarButtonItems=items;
+    
+    
+    
+    if (self.data_init==nil) {
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            
+            NSDictionary* editor_json = [iSalesNetwork request_CustomerInfo:self.contactId];
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                
+                
+                
+                if([[editor_json valueForKey:@"result"] intValue]==2)
+                {
+                    self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
+                    
+                    [self fillData];
+                    
+                    
+                }
+                else
+                {
+                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
+                }
+                
+                
+            });
+        });
+    }
+    else
+    {
+        [self fillData];
+    }
+    
+    
+    
+    
+    // Do any additional setup after loading the view.
+}
+- (void)onBackClick:(UIButton *)sender {
 
 
+    
+    [self.lastedit endEditing:true];
+    [self.lasttextview endEditing:true];
+    
+    
+    
+    NSMutableDictionary* back_data = [self.data_init mutableCopy];
+    
+    // [self.navigationController popViewControllerAnimated:(false)];
+    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
+    //    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
+    
+    for(int i=0;i<section_count;i++)
+    {
+        NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
+        int count = [[sectionjson valueForKey:@"count"] intValue];
+        for(int j=0;j<count;j++)
+        {
+            NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
+            
+            NSString* name = [itemjson valueForKey:@"name"];
+            
+            NSString* value = [itemjson valueForKey:@"value"];
+            
+            [back_data setValue:value forKey:name];
+            
+            
+            
+        }
+        
+    }
+    //---------------- construct customer_contact----------------------
+    NSString* customer_first_name = [back_data valueForKey:@"customer_first_name"];
+    if(customer_first_name==nil)
+        customer_first_name=@"";
+    
+    NSString* customer_last_name= [back_data valueForKey:@"customer_last_name"];
+    if(customer_last_name==nil)
+        customer_last_name=@"";
+    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
+    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+    [back_data setValue:customer_contact forKey:@"customer_contact"];
+    
+    
+    
+    
+    if(self.onClose)
+    {
+        
+        self.onClose(back_data);
+    }
+ 
+ 
+    [self.navigationController popViewControllerAnimated:(false)];
+    //    [self.navigationController dismissViewControllerAnimated:true completion:^{
+    //        ;
+    //    }];
+}
+- (void) fillData
+{
+    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
+    
+    
+    //    NSDictionary* data = [self.data_init objectForKey:@"customerInfo"];
+    for(int i=0;i<section_count;i++)
+    {
+        NSMutableDictionary * sectionjson= [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] mutableCopy];
+        int count = [[sectionjson valueForKey:@"count"] intValue];
+        for(int j=0;j<count;j++)
+        {
+            NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]] mutableCopy];
+            
+            NSString* control=[itemjson valueForKey:@"control"];
+            
+            NSString* name = [itemjson valueForKey:@"name"];
+            
+            NSString* value = [self.data_init valueForKey:name];
+            
+            [itemjson setValue:value forKey:@"value"];
+            
+            if([control isEqualToString:@"img"])
+            {
+                {
+                    NSString* img_url = [itemjson valueForKey:@"img_url_0"];
+                    
+                    NSString* url_value = [self.data_init valueForKey:img_url];
+                    [itemjson setValue:url_value forKey:@"img_url_0"];
+                }
+                {
+                    NSString* img_url = [itemjson valueForKey:@"img_url_1"];
+                    
+                    NSString* url_value = [self.data_init valueForKey:img_url];
+                    [itemjson setValue:url_value forKey:@"img_url_1"];
+                }
+                {
+                    NSString* img_url = [itemjson valueForKey:@"img_url_2"];
+                    
+                    NSString* url_value = [self.data_init valueForKey:img_url];
+                    [itemjson setValue:url_value forKey:@"img_url_2"];
+                }
+            }
+            
+            [sectionjson setObject:itemjson forKey:[NSString stringWithFormat:@"item_%d",j]];
+            
+            
+        }
+        [self.content_data_download setObject:sectionjson forKey:[NSString stringWithFormat:@"section_%d",i]];
+    }
+    self.content_data_control=[self translate_json:self.content_data_download changed:self.changed_data];
+    
+    //    self.navigationItem.title =  [self.content_data_download valueForKey:@"title"] ;
+    [self.editorTable reloadData];
 }
 }
+//- (IBAction)onEditClick:(id)sender {
+//
+//
+//    NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
+//
+//
+//    [params setValue:self.contactId forKey:@"contactId"];
+//    CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
+//
+//    cuseditVC.bnewcustomer=false;
+//    cuseditVC.url_type = URL_REMOTE;
+//    cuseditVC.request_url=URL_EDIT_CUSTOMER;
+//
+//    cuseditVC.params = params;
+//
+//    cuseditVC.delegate=self;
+//    //
+//    //    if(checked.count==count)
+//    //    {
+//    //    orderinfoVC.have_tail = true
+//    //    }
+//    [[self navigationController] setNavigationBarHidden:NO animated:NO];
+//    [self.navigationController pushViewController:cuseditVC animated:false];
+//
+//}
+//- (IBAction)onSetClick:(id)sender {
+//
+//        [self.lastedit endEditing:true];
+//    [self.lasttextview endEditing:true];
+//
+//
+//
+//
+//
+//   // [self.navigationController popViewControllerAnimated:(false)];
+//    int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
+////    NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
+//
+//    for(int i=0;i<section_count;i++)
+//    {
+//        NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
+//        int count = [[sectionjson valueForKey:@"count"] intValue];
+//        for(int j=0;j<count;j++)
+//        {
+//            NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
+//
+//            NSString* name = [itemjson valueForKey:@"name"];
+//
+//            NSString* value = [itemjson valueForKey:@"value"];
+//
+//            [self.data_init setValue:value forKey:name];
+//
+//
+//
+//        }
+//
+//    }
+//    //---------------- construct customer_contact----------------------
+//    NSString* customer_first_name = [self.data_init valueForKey:@"customer_first_name"];
+//    if(customer_first_name==nil)
+//        customer_first_name=@"";
+//
+//    NSString* customer_last_name= [self.data_init valueForKey:@"customer_last_name"];
+//    if(customer_last_name==nil)
+//        customer_last_name=@"";
+//    NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
+//    customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+//    [self.data_init setValue:customer_contact forKey:@"customer_contact"];
+//    //---------------- finish construct customer_contact----------------------
+//
+//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    if(self.update_order && appDelegate.order_code!=nil)
+//    {
+//
+//
+//
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//            NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:self.data_init];
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//
+//
+//                if([[editor_json valueForKey:@"result"] intValue]==2)
+//                {
+//
+//                    [self.navigationController popViewControllerAnimated:false];
+//                    if(self.returnValue)
+//                    {
+//
+//                        self.returnValue(self.data_init);
+//                    }
+//
+//
+//
+//                }
+//                else
+//                {
+//                    [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
+//                }
+//
+//
+//
+//            });
+//        });
+//
+//
+//    }
+//    else
+//    {
+//
+//        [self.navigationController popViewControllerAnimated:false];
+//        if(self.returnValue)
+//        {
+//            self.returnValue(self.data_init);
+//
+//        }
+//        //    [self.data_init setObject:data forKey:@"customerInfo"];
+//
+//
+//        /*
+//         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//         appDelegate.contact_id=self.contactId;
+//         appDelegate.customerInfo = self.data_init;
+//         */
+//
+////        [self.navigationController popToRootViewControllerAnimated:false];
+//    }
+//
+//
+//
+//}
 
 
 #pragma mark- img changed
 #pragma mark- img changed
 
 
 // image 改变时执行
 // image 改变时执行
 - (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath{
 - (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath{
     
     
-   // int aaa = 0;
-   // NSDictionary* aaa = self.content_data_download;
+    // int aaa = 0;
+    // NSDictionary* aaa = self.content_data_download;
+    
     
     
     
     
-   
     UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
     UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-         NSString* cid=[self getValue:@"customer_cid"];
+        NSString* cid=[self getValue:@"customer_cid"];
         NSDictionary* return_json = [iSalesNetwork update_customer_img:cid img_url:url_up];
         NSDictionary* return_json = [iSalesNetwork update_customer_img:cid img_url:url_up];
         
         
         dispatch_async(dispatch_get_main_queue(), ^{
         dispatch_async(dispatch_get_main_queue(), ^{
@@ -310,70 +612,70 @@
         });
         });
     });
     });
     
     
-//    // NSLog(@"Sender is = %@", url);
-//    
-//    
-//    
-//    
-//    NSMutableDictionary* section_json=nil;
-//    
-//    
-//    //    NSLog(@"endedit %d_%d",indexPath.section,indexPath.row);
-//    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
-//    
-//    int refresh = [[item_json valueForKey:@"refresh"] intValue];
-//    
-//    NSString* subid=[item_json valueForKey:@"subid"];
-//    
-//    item_json[@"img_url"]=url_down;
-//    item_json[@"avalue"]=url_up;
-//    
-//    if(subid==nil)
-//    {
-//        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
-//        int count=0;
-//        
-//        count=[[section_json valueForKey:@"count"] intValue];
-//        
-//        for(int i=0;i<count;i++)
-//        {
-//            NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
-//            if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
-//                [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",i ]];
-//            
-//            
-//        }
-//        
-//    }
-//    else
-//    {
-//        NSArray* idarr=[subid componentsSeparatedByString:@"_"];
-//        int section = [(NSString*)idarr[0] intValue];
-//        int item=[(NSString*)idarr[1] intValue];
-//        
-//        
-//        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d", section]] mutableCopy];
-//        NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",item ]];
-//        item_json= [self enum_subitem_changed:[olditem mutableCopy] subid:idarr value:item_json step:2];
-//        [item_json setValue:@"true" forKey:@"dirty"];
-//        [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",item ]];
-//    }
-//    
-//    
-//    
-//    [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
-//    
-//    self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
-//    
-//    NSRange range = NSMakeRange(indexPath.section, 1);
-//    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
-//    //  [self.editorTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
-//    
-//    
-//    if(refresh==1)
-//    {
-//        [self refresh];
-//    }
+    //    // NSLog(@"Sender is = %@", url);
+    //
+    //
+    //
+    //
+    //    NSMutableDictionary* section_json=nil;
+    //
+    //
+    //    //    NSLog(@"endedit %d_%d",indexPath.section,indexPath.row);
+    //    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
+    //
+    //    int refresh = [[item_json valueForKey:@"refresh"] intValue];
+    //
+    //    NSString* subid=[item_json valueForKey:@"subid"];
+    //
+    //    item_json[@"img_url"]=url_down;
+    //    item_json[@"avalue"]=url_up;
+    //
+    //    if(subid==nil)
+    //    {
+    //        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
+    //        int count=0;
+    //
+    //        count=[[section_json valueForKey:@"count"] intValue];
+    //
+    //        for(int i=0;i<count;i++)
+    //        {
+    //            NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
+    //            if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
+    //                [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",i ]];
+    //
+    //
+    //        }
+    //
+    //    }
+    //    else
+    //    {
+    //        NSArray* idarr=[subid componentsSeparatedByString:@"_"];
+    //        int section = [(NSString*)idarr[0] intValue];
+    //        int item=[(NSString*)idarr[1] intValue];
+    //
+    //
+    //        section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d", section]] mutableCopy];
+    //        NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",item ]];
+    //        item_json= [self enum_subitem_changed:[olditem mutableCopy] subid:idarr value:item_json step:2];
+    //        [item_json setValue:@"true" forKey:@"dirty"];
+    //        [section_json setObject:item_json  forKey:[NSString stringWithFormat:@"item_%d",item ]];
+    //    }
+    //
+    //
+    //
+    //    [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
+    //
+    //    self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
+    //
+    //    NSRange range = NSMakeRange(indexPath.section, 1);
+    //    NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
+    //    //  [self.editorTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
+    //
+    //
+    //    if(refresh==1)
+    //    {
+    //        [self refresh];
+    //    }
 }
 }
 
 
 - (void)didReceiveMemoryWarning {
 - (void)didReceiveMemoryWarning {
@@ -382,13 +684,13 @@
 }
 }
 
 
 /*
 /*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
-}
-*/
+ #pragma mark - Navigation
+ 
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+ // Get the new view controller using [segue destinationViewController].
+ // Pass the selected object to the new view controller.
+ }
+ */
 
 
 @end
 @end

+ 3 - 0
RedAnt ERP Mobile/common/Functions/contact/customer_info_template.json

@@ -26,6 +26,9 @@
             "img_url_0":"business_card_0",
             "img_url_0":"business_card_0",
             "img_url_1":"business_card_1",
             "img_url_1":"business_card_1",
             "img_url_2":"business_card_2",
             "img_url_2":"business_card_2",
+            "img_url_aname_0":"business_card_0",
+            "img_url_aname_1":"business_card_1",
+            "img_url_aname_2":"business_card_2",
             "value": ""
             "value": ""
         },
         },
 
 

+ 3 - 0
RedAnt ERP Mobile/common/Functions/contact/customer_info_template_edit.json

@@ -25,6 +25,9 @@
             "img_url_0":"business_card_0",
             "img_url_0":"business_card_0",
             "img_url_1":"business_card_1",
             "img_url_1":"business_card_1",
             "img_url_2":"business_card_2",
             "img_url_2":"business_card_2",
+            "img_url_aname_0":"business_card_0",
+            "img_url_aname_1":"business_card_1",
+            "img_url_aname_2":"business_card_2",
             "value": ""
             "value": ""
         },
         },
         
         

+ 19 - 12
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -261,7 +261,14 @@
             
             
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
             [alert show];
             [alert show];
@@ -277,19 +284,19 @@
         else
         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];
-//
+//            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];
 //                
 //                
 //                
 //                
-//                [alert show];
-                
-                
-                
-                [RAUtils alert_view:@"Cannot add model without price." title:@"Model No Price."];
-            }
-            else
+//                
+//                [RAUtils alert_view:@"Cannot add model without price." title:@"Model No Price."];
+//            }
+//            else
             {
             {
                 
                 
                 int c=[self.count_Label.text intValue];
                 int c=[self.count_Label.text intValue];

+ 1 - 0
RedAnt ERP Mobile/common/Functions/order/OrderDetailModelCell.h

@@ -16,6 +16,7 @@
 @property (strong, nonatomic) IBOutlet UILabel *qtyLabel;
 @property (strong, nonatomic) IBOutlet UILabel *qtyLabel;
 @property (strong, nonatomic) IBOutlet UILabel *subtotalLabel;
 @property (strong, nonatomic) IBOutlet UILabel *subtotalLabel;
 @property (strong, nonatomic) IBOutlet UILabel *statusLabel;
 @property (strong, nonatomic) IBOutlet UILabel *statusLabel;
+@property (strong, nonatomic) IBOutlet UILabel *noteLabel;
 @property (strong, nonatomic) IBOutlet UIButton *buttonBundle;
 @property (strong, nonatomic) IBOutlet UIButton *buttonBundle;
 @property (strong, nonatomic) IBOutlet StrikethroughLabel *labelOldPrice;
 @property (strong, nonatomic) IBOutlet StrikethroughLabel *labelOldPrice;
 @property (strong, nonatomic) IBOutlet UILabel *labelDiscount;
 @property (strong, nonatomic) IBOutlet UILabel *labelDiscount;

+ 14 - 0
RedAnt ERP Mobile/common/Functions/order/OrderDetailSignatureCell.h

@@ -0,0 +1,14 @@
+//
+//  OrderDetailSignatureCell.h
+//  iSales-NPD
+//
+//  Created by Ray on 2/23/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface OrderDetailSignatureCell : UITableViewCell
+@property (strong, nonatomic) IBOutlet UIImageView *sign_img;
+
+@end

+ 23 - 0
RedAnt ERP Mobile/common/Functions/order/OrderDetailSignatureCell.m

@@ -0,0 +1,23 @@
+//
+//  OrderDetailSignatureCell.m
+//  iSales-NPD
+//
+//  Created by Ray on 2/23/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import "OrderDetailSignatureCell.h"
+
+@implementation OrderDetailSignatureCell
+
+- (void)awakeFromNib {
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 366 - 388
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m


+ 159 - 39
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -94,11 +94,42 @@
     [ref addTarget:self action:@selector(manually_refresh) forControlEvents:UIControlEventValueChanged];
     [ref addTarget:self action:@selector(manually_refresh) forControlEvents:UIControlEventValueChanged];
     [self.table_order addSubview:ref];
     [self.table_order addSubview:ref];
     
     
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *documents = [paths objectAtIndex:0];
+    NSString *dist_path = [documents stringByAppendingPathComponent:@"status_filter_cadedate.json"];
+    
+    
+//    if ([[NSFileManager defaultManager] fileExistsAtPath:dist_path]) {
+//        
+//        NSLog(@"文件已经存在了");
+//        
+//    }
+//    else
+//    {
+//        
+//        
+//        
+//        //        NSLog(@"resourceSampleImagesFolderPath=%@",resourceFolderPath);
+//        
+//        NSData *mainBundleFile = [NSData dataWithContentsOfFile:order_filter_source_path];
+//        
+//        //        NSLog(@"mainBundleFile==%@",mainBundleFile);
+//        
+//        [[NSFileManager defaultManager] createFileAtPath:dist_path
+//         
+//                                                contents:mainBundleFile
+//         
+//                                              attributes:nil];
+//        
+//    }
+
+    
     NSData* json =nil;
     NSData* json =nil;
     if(self.init_style==OL_OPEN)
     if(self.init_style==OL_OPEN)
         json=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"status_filter_cadedate_open" ofType:@"json" ]];
         json=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"status_filter_cadedate_open" ofType:@"json" ]];
     else
     else
-        json=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"status_filter_cadedate" ofType:@"json" ]];
+        json=[NSData dataWithContentsOfFile:dist_path];
     NSError *error=nil;
     NSError *error=nil;
     self.status_cadedate = [[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
     self.status_cadedate = [[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
 
 
@@ -222,8 +253,19 @@
 }
 }
 - (IBAction)onNewOrderClicked:(id)sender {
 - (IBAction)onNewOrderClicked:(id)sender {
     
     
-    
-    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Attention", nil) message:NSLocalizedString(@"Are you sure to create a new order?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
+    NSString* msg=@"Do you want to create a new order?";
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.order_code.length==0)
+    {
+ 
+        if(appDelegate.contact_id.length>0)
+        {
+            msg = [msg stringByAppendingString:@"\n\nCustomer:"];
+            msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+            
+        }
+    }
+    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Attention", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
     [alert show];
     [alert show];
     
     
     
     
@@ -484,51 +526,99 @@ dispatch_async(dispatch_get_main_queue(), ^{
     if(buttonIndex!=alertView.cancelButtonIndex)
     if(buttonIndex!=alertView.cancelButtonIndex)
     {
     {
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        appDelegate.order_code= nil;
-        [appDelegate SetSo:nil];
         
         
-       //     MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-        ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-        cvc.showNavibar = true;
-        cvc.contact_type = @"Sales_Order_Customer";
-        cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
+        if(appDelegate.order_code.length>0)
+        {
+            appDelegate.order_code= nil;
+            [appDelegate SetSo:nil];
+            
+                   //     MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
+                    ContactListViewController* cvc = [self.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;
+            
+                        self.norefresh = true;
+                        [self neworder];
             
             
-            appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-            appDelegate.customerInfo = value;
             
             
-            self.norefresh = true;
-            [self neworder];
             
             
+                    //    [main_vc checklogin:true];
+                        //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
             
             
+                        //
+                        //                if(self.returnValue)
+                        //                    self.returnValue(value);
+                    };
             
             
-        //    [main_vc checklogin:true];
-            //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
+                    cvc.onCancel = ^(){
+                        self.norefresh = true;
+                        if(appDelegate.customerInfo==nil)
+                        {
+                            [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"" controller:self];
+                        }
+                        else
+                        {
+                            [self neworder];
+                        }
+                      //  [main_vc checklogin:true];
+                    };
+                    cvc.onReset = ^(){
+                     //   [main_vc checklogin:true];
+                    };
+            
+                    [self.navigationController pushViewController:cvc animated:true];
             
             
-            //
-            //                if(self.returnValue)
-            //                    self.returnValue(value);
-        };
+            
+        }
+        else
+        {
+        //create new;
         
         
-        cvc.onCancel = ^(){
-            self.norefresh = true;
-            if(appDelegate.customerInfo==nil)
-            {
+        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
+        {
+                MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
+            ContactListViewController* cvc = [self.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];
+                
+                //   [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:@"" controller:self];
                 [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"" controller:self];
-            }
-            else
-            {
-                [self neworder];
-            }
-          //  [main_vc checklogin:true];
-        };
-        cvc.onReset = ^(){
-         //   [main_vc checklogin:true];
-        };
-        
-        [self.navigationController pushViewController:cvc animated:true];
-        
-        
-        
+                
+                
+                
+            };
+            cvc.onReset = ^(){
+                [main_vc checklogin:true];
+            };
+            
+            [self.navigationController pushViewController:cvc animated:true];
+        }
+        else
+        {
+            [self neworder];
+        }
+        }
 
 
     }
     }
 }
 }
@@ -1113,6 +1203,36 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     self.status_cadedate = value;
     self.status_cadedate = value;
     
     
     
     
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *documents = [paths objectAtIndex:0];
+    NSString *dist_path = [documents stringByAppendingPathComponent:@"status_filter_cadedate.json"];
+    
+    
+    //    if ([[NSFileManager defaultManager] fileExistsAtPath:dist_path]) {
+    //
+    //        NSLog(@"文件已经存在了");
+    //
+    //    }
+    //    else
+    //    {
+    //
+    //
+    //
+            //        NSLog(@"resourceSampleImagesFolderPath=%@",resourceFolderPath);
+    
+NSData *data = [NSJSONSerialization dataWithJSONObject:self.status_cadedate options:kNilOptions error:nil];
+    
+            //        NSLog(@"mainBundleFile==%@",mainBundleFile);
+    
+            [[NSFileManager defaultManager] createFileAtPath:dist_path
+    
+                                                    contents:data
+    
+                                                  attributes:nil];
+    //
+    //    }
+    
 
 
     
     
     
     

+ 17 - 3
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -86,7 +86,14 @@
                     
                     
                     if(appDelegate.can_create_order)
                     if(appDelegate.can_create_order)
                     {
                     {
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                        NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                        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];
                     
                     
                     
                     
                     
                     
@@ -141,7 +148,14 @@
             [main_vc checklogin:false];
             [main_vc checklogin:false];
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
             [alert show];
             [alert show];
@@ -1019,7 +1033,7 @@
         vc.cart_id = [NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
         vc.cart_id = [NSString stringWithFormat:@"%d",[[item_json valueForKey:@"item_id"] intValue]];
         //    vc.delegate = parentvc.self;
         //    vc.delegate = parentvc.self;
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-        vc.onSetValue = ^(){
+        vc.onSetValue = ^(double price,double discount){
             [self reload_data];//[main_vc checklogin:true];
             [self reload_data];//[main_vc checklogin:true];
         };
         };
         
         

+ 16 - 2
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -608,7 +608,14 @@
                     
                     
                     if(appDelegate.can_create_order)
                     if(appDelegate.can_create_order)
                     {
                     {
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                        NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                        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];
                     
                     
                     
                     
                     
                     
@@ -664,7 +671,14 @@
             
             
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
             [alert show];
             [alert show];

+ 16 - 2
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -533,7 +533,14 @@
                     [main_vc checklogin:false];
                     [main_vc checklogin:false];
                     if(appDelegate.can_create_order)
                     if(appDelegate.can_create_order)
                     {
                     {
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                        NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                        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];
                     
                     
                     
                     
                     
                     
@@ -588,7 +595,14 @@
          //   [main_vc checklogin:false];
          //   [main_vc checklogin:false];
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
             [alert show];
             [alert show];

+ 11 - 5
RedAnt ERP Mobile/common/Functions/signature/SignatureView.m

@@ -75,7 +75,7 @@
     self.blank = YES;
     self.blank = YES;
     self.boundary = CGRectNull;
     self.boundary = CGRectNull;
     
     
-    [self clearWithColor:[UIColor whiteColor]];
+   // [self clearWithColor:[UIColor whiteColor]];
     [self clearWithColor:[UIColor clearColor]];
     [self clearWithColor:[UIColor clearColor]];
 }
 }
 
 
@@ -88,12 +88,18 @@
     [self.image drawInRect:CGRectMake(0, 0, screenSize.width, screenSize.height)];
     [self.image drawInRect:CGRectMake(0, 0, screenSize.width, screenSize.height)];
     
     
     CGContextSetFillColorWithColor(context, color.CGColor);
     CGContextSetFillColorWithColor(context, color.CGColor);
-    CGContextFillRect(context, CGRectMake(0, 0, screenSize.width, screenSize.height));
+  //  CGContextFillRect(context, CGRectMake(0, 0, screenSize.width, screenSize.height));
+    if(color==[UIColor clearColor])
+        CGContextClearRect(context, CGRectMake(0, 0, screenSize.width, screenSize.height));
+    else
+        CGContextFillRect(context, CGRectMake(0, 0, screenSize.width, screenSize.height));
     
     
     UIImage *cleanImage = UIGraphicsGetImageFromCurrentImageContext();
     UIImage *cleanImage = UIGraphicsGetImageFromCurrentImageContext();
     self.image = cleanImage;
     self.image = cleanImage;
     
     
     UIGraphicsEndImageContext();
     UIGraphicsEndImageContext();
+    
+    
 }
 }
 
 
 - (BOOL)isSigned {
 - (BOOL)isSigned {
@@ -129,7 +135,7 @@
 //    
 //    
 //    UIImage* img= [[UIImage imageWithCGImage: CGImageCreateWithImageInRect(self.image.CGImage, rect)] copy];
 //    UIImage* img= [[UIImage imageWithCGImage: CGImageCreateWithImageInRect(self.image.CGImage, rect)] copy];
 
 
-    return [[UIImage imageWithCGImage: CGImageCreateWithImageInRect(self.image.CGImage, CGRectInset(rect, -1, -1))] copy];
+    return [[UIImage imageWithCGImage: CGImageCreateWithImageInRect(self.image.CGImage, CGRectInset(rect, -10, -10))] copy];
     //return [self.image copy];
     //return [self.image copy];
 }
 }
 
 
@@ -172,8 +178,8 @@
 
 
 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
     
     
-  //  NSArray *generalizedPoints = [self _douglasPeucker:self.drawnPoints epsilon:2];
-    NSArray *splinePoints = self.drawnPoints;//[self _catmullRomSpline:generalizedPoints segments:8];
+    NSArray *generalizedPoints = [self _douglasPeucker:self.drawnPoints epsilon:2];
+    NSArray *splinePoints = /*self.drawnPoints;//*/[self _catmullRomSpline:generalizedPoints segments:8];
     
     
     self.image = [self _drawLineWithPoints:splinePoints image:self.tempImage];
     self.image = [self _drawLineWithPoints:splinePoints image:self.tempImage];
     
     

+ 16 - 3
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -74,8 +74,14 @@
                     
                     
                     [main_vc checklogin:false];
                     [main_vc checklogin:false];
                     if(appDelegate.can_create_order)
                     if(appDelegate.can_create_order)
-                    {
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                    {                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                        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];
                     
                     
                     
                     
                     
                     
@@ -130,7 +136,14 @@
             [main_vc checklogin:false];
             [main_vc checklogin:false];
             if(appDelegate.can_create_order)
             if(appDelegate.can_create_order)
             {
             {
-            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"Do you want to add to a pending 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];
+                NSString* msg =@"Do you want to switch to a pending order or a new order?";
+                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.
             [alert show];
             [alert show];

+ 1 - 1
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.h

@@ -41,7 +41,7 @@
 
 
 +(NSDictionary*) cart_incresement:(NSString*) cart_id increse:(bool) increse;
 +(NSDictionary*) cart_incresement:(NSString*) cart_id increse:(bool) increse;
 +(NSDictionary*) cart_setQTY:(NSString*) cart_id value:(int) value;
 +(NSDictionary*) cart_setQTY:(NSString*) cart_id value:(int) value;
-+(NSDictionary*) cart_setPrice:(NSString*) cart_id price:(float) price discount:(float) discount;
++(NSDictionary*) cart_setPrice:(NSString*) cart_id price:(float) price discount:(float) discount notes:(NSString*) notes;
 +(NSDictionary*) cart_setFree:(NSString*) cart_id isfree:(bool) isfree;
 +(NSDictionary*) cart_setFree:(NSString*) cart_id isfree:(bool) isfree;
 
 
 +(NSDictionary*) cart_setItemNote:(NSString*) cart_id notes:(NSString*) notes;
 +(NSDictionary*) cart_setItemNote:(NSString*) cart_id notes:(NSString*) notes;

+ 7 - 4
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

@@ -1014,6 +1014,8 @@ repeat:{
     {
     {
         NSError *error=nil;
         NSError *error=nil;
         NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
         NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+        
+        [appDelegate SetSo:[jsobj valueForKey:@"so#"]];
         return jsobj;
         return jsobj;
     }
     }
     else
     else
@@ -1534,7 +1536,7 @@ repeat:{
     }
     }
     return jsobj;
     return jsobj;
 }
 }
-+(NSDictionary*) cart_setPrice:(NSString*) cart_id price:(float) price discount:(float) discount
++(NSDictionary*) cart_setPrice:(NSString*) cart_id price:(float) price discount:(float) discount notes:(NSString*) notes
 {
 {
     if(![self IsNetworkAvailable])
     if(![self IsNetworkAvailable])
         return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
         return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
@@ -1548,7 +1550,7 @@ repeat:{
         [params setValue:appDelegate.password forKey:@"password"];
         [params setValue:appDelegate.password forKey:@"password"];
     
     
     [params setValue:cart_id forKey:@"cartitem_id"];
     [params setValue:cart_id forKey:@"cartitem_id"];
-    
+    [params setValue:notes forKey:@"item_note"];
     
     
     [params setValue:[NSString stringWithFormat:@"%f",price] forKey:@"price"];
     [params setValue:[NSString stringWithFormat:@"%f",price] forKey:@"price"];
     
     
@@ -1773,7 +1775,7 @@ repeat:{
     if (result==2)
     if (result==2)
     {
     {
         
         
-                appDelegate.cart_count = [[jsobj valueForKey:@"count"] intValue];
+                appDelegate.cart_count = [[jsobj valueForKey:@"cart_count"] intValue];
         //appDelegate.wish_count =[[jsobj valueForKey:@"count"] intValue];
         //appDelegate.wish_count =[[jsobj valueForKey:@"count"] intValue];
         //    appDelegate.port_count =[[jsobj valueForKey:@"portfolio_count"] intValue];
         //    appDelegate.port_count =[[jsobj valueForKey:@"portfolio_count"] intValue];
         
         
@@ -2165,7 +2167,7 @@ repeat:{
         appDelegate.can_delete_order =false;
         appDelegate.can_delete_order =false;
         appDelegate.can_submit_order =false;
         appDelegate.can_submit_order =false;
         appDelegate.can_set_tearsheet_price =false;
         appDelegate.can_set_tearsheet_price =false;
-        
+        appDelegate.can_update_contact_info = false;
         
         
         appDelegate.ipad_perm =nil ;
         appDelegate.ipad_perm =nil ;
         
         
@@ -2375,6 +2377,7 @@ repeat:{
         appDelegate.can_cancel_order =[[objheader valueForKey:@"can_cancel_order"] boolValue];
         appDelegate.can_cancel_order =[[objheader valueForKey:@"can_cancel_order"] boolValue];
         appDelegate.can_set_cart_price =[[objheader valueForKey:@"can_set_cart_price"] boolValue];
         appDelegate.can_set_cart_price =[[objheader valueForKey:@"can_set_cart_price"] boolValue];
         appDelegate.can_delete_order =[[objheader valueForKey:@"can_delete_order"] boolValue];
         appDelegate.can_delete_order =[[objheader valueForKey:@"can_delete_order"] boolValue];
+        appDelegate.can_update_contact_info =[[objheader valueForKey:@"can_update_contact_info"] boolValue];
         appDelegate.can_submit_order =[[objheader valueForKey:@"can_submit_order"] boolValue];
         appDelegate.can_submit_order =[[objheader valueForKey:@"can_submit_order"] boolValue];
         appDelegate.can_set_tearsheet_price =[[objheader valueForKey:@"can_set_tearsheet_price"] boolValue];
         appDelegate.can_set_tearsheet_price =[[objheader valueForKey:@"can_set_tearsheet_price"] boolValue];
         
         

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно