|
|
@@ -930,6 +930,151 @@ typedef enum {
|
|
|
// DebugLog(@"cart sort button clicked");
|
|
|
|
|
|
NSLog(@"button clicked;");
|
|
|
+
|
|
|
+ if([sender.titleLabel.text isEqualToString:@"Initial All"])
|
|
|
+ {
|
|
|
+
|
|
|
+ __weak __typeof(self)weakSelf = self;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ long index = sender.tag - CONTROL_BASE;
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary* control_json = self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ];
|
|
|
+
|
|
|
+
|
|
|
+ // CGRect cellrect_screen = [RAUtils relativeFrameForScreenWithView:trigger];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // CGRect rect1=[self.view convertRect:cellrect_screen fromView:[[[UIApplication sharedApplication] delegate] window]];
|
|
|
+ //
|
|
|
+ // DebugLog(@"convert1 %@",NSStringFromCGRect(rect1));
|
|
|
+// SignatureListViewController *signatureVC = [ [UIStoryboard storyboardWithName:@"signature" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"SignatureListViewController"];
|
|
|
+// signatureVC.title=@"Signatures";
|
|
|
+// signatureVC.signatureData = self.signatureData;
|
|
|
+// signatureVC.subType = control_json[@"name"];
|
|
|
+// signatureVC.can_fill= [control_json[@"can_fill"] boolValue];
|
|
|
+// signatureVC.signature_ratio= sender.frame.size;
|
|
|
+
|
|
|
+ // signatureVC.imageView = touchImageView;
|
|
|
+
|
|
|
+// signatureVC.blk_Select =^(NSString* file)
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// // NSString* file_name=[file lastPathComponent];
|
|
|
+//
|
|
|
+// NSData* img_data=[ImageUtils load_img:file];
|
|
|
+//
|
|
|
+// if(img_data!=nil)
|
|
|
+// {
|
|
|
+//
|
|
|
+// UIImage* image=[UIImage imageWithData:img_data];
|
|
|
+// touchImageView.image = image;
|
|
|
+//
|
|
|
+// long index = touchImageView.tag - CONTROL_BASE;
|
|
|
+// weakSelf.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
+// weakSelf.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+// }
|
|
|
+//
|
|
|
+// };
|
|
|
+// signatureVC.blk_Fill =^(NSString* file,bool fillFullDoc)
|
|
|
+// {
|
|
|
+//
|
|
|
+// if(weakSelf.blk_Fill)
|
|
|
+// weakSelf.blk_Fill(file,control_json[@"name"],fillFullDoc);
|
|
|
+// // for(int j=0;j<[self.controlTemplate[@"count"] intValue];j++)
|
|
|
+// // {
|
|
|
+// // NSMutableDictionary* dest =self.controlTemplate[[NSString stringWithFormat:@"control_%d",j]];
|
|
|
+// // NSString* type = dest[@"type"];
|
|
|
+// // if(![type isEqualToString:@"Signature"])
|
|
|
+// // continue;
|
|
|
+// // if([dest[@"name"] isEqualToString:control_json[@"name"]])
|
|
|
+// // {
|
|
|
+// // dest[@"value"]=file;
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// [weakSelf refreshControl];
|
|
|
+//
|
|
|
+// // // NSString* file_name=[file lastPathComponent];
|
|
|
+// //
|
|
|
+// // NSData* img_data=[ImageUtils load_img:file];
|
|
|
+// //
|
|
|
+// // if(img_data!=nil)
|
|
|
+// // {
|
|
|
+// //
|
|
|
+// // UIImage* image=[UIImage imageWithData:img_data];
|
|
|
+// // touchImageView.image = image;
|
|
|
+// //
|
|
|
+// // long index = touchImageView.tag - CONTROL_BASE;
|
|
|
+// // self.controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
+// //
|
|
|
+// // }
|
|
|
+//
|
|
|
+// };
|
|
|
+// signatureVC.blk_Add = ^()
|
|
|
+ {
|
|
|
+
|
|
|
+ __block UIImage* signimg=nil;
|
|
|
+ SignatureViewController * vc =[ [UIStoryboard storyboardWithName:@"signature" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"SignatureViewController"];
|
|
|
+ vc.title =[NSString stringWithFormat:@"Signature: %@",control_json[@"name"]];
|
|
|
+ vc.signature_ratio= sender.frame.size;
|
|
|
+ vc.linewidth = [control_json[@"linewidth"] intValue];
|
|
|
+ vc.onReturnImg = ^(UIImage* img)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ signimg = img;
|
|
|
+
|
|
|
+ if(signimg!=nil)
|
|
|
+ {
|
|
|
+ NSString* file=[PDFUtils addSignature:signimg to:self.signatureData subType:@"Customer Initial"];
|
|
|
+// long index = sender.tag - CONTROL_BASE;
|
|
|
+// self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"value"] = file;
|
|
|
+// self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"dirty"] =[NSNumber numberWithBool:true];
|
|
|
+
|
|
|
+
|
|
|
+ if(weakSelf.blk_Fill)
|
|
|
+ weakSelf.blk_Fill(file,@"Customer Initial",true);
|
|
|
+
|
|
|
+// touchImageView.image = signimg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
+ // orderinfoVC.url_type = URL_REMOTE;
|
|
|
+ // orderinfoVC.request_url=URL_CARTDELIVERY;
|
|
|
+ //
|
|
|
+ // orderinfoVC.params = params;
|
|
|
+ //
|
|
|
+ // orderinfoVC.delegate=self;
|
|
|
+ //
|
|
|
+ // if(checked.count==count)
|
|
|
+ // {
|
|
|
+ // orderinfoVC.have_tail = true
|
|
|
+ // }
|
|
|
+
|
|
|
+ [self.navigationController pushViewController:vc animated:true];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+// UINavigationController * navi = [[UINavigationController alloc] initWithRootViewController:signatureVC];
|
|
|
+// navi.modalPresentationStyle=UIModalPresentationPopover;
|
|
|
+//
|
|
|
+// UIPopoverPresentationController* popPc = navi.popoverPresentationController;
|
|
|
+// popPc.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
|
|
+// popPc.sourceView = touchImageView;
|
|
|
+// popPc.delegate = nil;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// [self presentViewController:navi animated:true completion:nil];
|
|
|
+ }
|
|
|
// [self.view addSubview:self.sortItemController.view];
|
|
|
}
|
|
|
- (void)CheckButtonClicked:(UIButton *)sender {
|
|
|
@@ -995,82 +1140,91 @@ typedef enum {
|
|
|
NSMutableDictionary* action = item[2];
|
|
|
if(checked)
|
|
|
{
|
|
|
-
|
|
|
- NSArray* disable_arr = action[@"disable"] ;
|
|
|
- for(int d = 0 ; d<disable_arr.count;d++)
|
|
|
- {
|
|
|
- self.page_controlTemplate [disable_arr[d] ] [@"disable"] = [NSNumber numberWithBool:true];
|
|
|
- NSString* s_idx =disable_arr[d];
|
|
|
- s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
- int d_idx = [s_idx intValue];
|
|
|
- ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = false;
|
|
|
- }
|
|
|
- NSArray* enable_arr = action[@"enable"] ;
|
|
|
- for(int e = 0 ; e<enable_arr.count;e++)
|
|
|
- {
|
|
|
- self.page_controlTemplate [enable_arr[e] ] [@"disable"] = [NSNumber numberWithBool:false];
|
|
|
-
|
|
|
- NSString* s_idx =enable_arr[e];
|
|
|
- s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
- int d_idx = [s_idx intValue];
|
|
|
-
|
|
|
- ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = true;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- NSMutableDictionary* json_setval=action[@"set_val"] ;
|
|
|
- for(int i=0;i<[json_setval[@"count"] intValue];i++)
|
|
|
- {
|
|
|
-
|
|
|
- NSMutableDictionary * control = json_setval [[NSString stringWithFormat:@"item_%d",i] ];
|
|
|
- UITextView* tv = (UITextView*) [self findControl:control[@"control"]];
|
|
|
- NSString* value = control[@"value"];
|
|
|
-
|
|
|
- UITextView* tv6 = (UITextView*) [self findControl:@"control_10"];
|
|
|
- NSString* text = tv6.text;
|
|
|
- NSString* newvalue = nil;
|
|
|
- if([value isEqualToString:@"*0.1"])
|
|
|
+ if([action[@"type"] isEqualToString:@"disable"] )
|
|
|
{
|
|
|
+ NSArray* disable_arr = action[@"disable"] ;
|
|
|
+ for(int d = 0 ; d<disable_arr.count;d++)
|
|
|
+ {
|
|
|
+ self.page_controlTemplate [disable_arr[d] ] [@"disable"] = [NSNumber numberWithBool:true];
|
|
|
+ NSString* s_idx =disable_arr[d];
|
|
|
+ s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
+ int d_idx = [s_idx intValue];
|
|
|
+ ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = false;
|
|
|
+ }
|
|
|
+ NSArray* enable_arr = action[@"enable"] ;
|
|
|
+ for(int e = 0 ; e<enable_arr.count;e++)
|
|
|
+ {
|
|
|
+ self.page_controlTemplate [enable_arr[e] ] [@"disable"] = [NSNumber numberWithBool:false];
|
|
|
+
|
|
|
+ NSString* s_idx =enable_arr[e];
|
|
|
+ s_idx=[s_idx stringByReplacingOccurrencesOfString:@"control_" withString:@""];
|
|
|
+ int d_idx = [s_idx intValue];
|
|
|
+
|
|
|
+ ((UITextView*)[sender.superview viewWithTag:d_idx+CONTROL_BASE]).editable = true;
|
|
|
+ }
|
|
|
|
|
|
- NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
- formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
- NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
- if(prefix_str.length==0)
|
|
|
- prefix_str = @"";
|
|
|
- text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
- double f = [[formatter numberFromString:text] doubleValue]*0.1;
|
|
|
- newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
+
|
|
|
|
|
|
- newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
- // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.1;
|
|
|
- // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
- self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
- }
|
|
|
- else if([value isEqualToString:@"*0.9"])
|
|
|
- {
|
|
|
- // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
|
|
|
- NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
- formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
- NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
- if(prefix_str.length==0)
|
|
|
- prefix_str = @"";
|
|
|
- text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
- double f = [[formatter numberFromString:text] doubleValue]*0.9;
|
|
|
- newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
- newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
- // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
- self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
- self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary* json_setval=action[@"set_val"] ;
|
|
|
+ for(int i=0;i<[json_setval[@"count"] intValue];i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ NSMutableDictionary * control = json_setval [[NSString stringWithFormat:@"item_%d",i] ];
|
|
|
+ UITextView* tv = (UITextView*) [self findControl:control[@"control"]];
|
|
|
+ NSString* value = control[@"value"];
|
|
|
+
|
|
|
+ UITextView* tv6 = (UITextView*) [self findControl:@"control_10"];
|
|
|
+ NSString* text = tv6.text;
|
|
|
+ NSString* newvalue = nil;
|
|
|
+ if([value isEqualToString:@"*0.1"])
|
|
|
+ {
|
|
|
+
|
|
|
+ NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
+ formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
+ if(prefix_str.length==0)
|
|
|
+ prefix_str = @"";
|
|
|
+ text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
+ double f = [[formatter numberFromString:text] doubleValue]*0.1;
|
|
|
+ newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
+
|
|
|
+ newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
+ // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.1;
|
|
|
+ // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ }
|
|
|
+ else if([value isEqualToString:@"*0.9"])
|
|
|
+ {
|
|
|
+ // float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
|
|
|
+ NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
|
|
|
+ formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
|
|
|
+ NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
|
|
|
+ if(prefix_str.length==0)
|
|
|
+ prefix_str = @"";
|
|
|
+ text=[text stringByReplacingOccurrencesOfString:prefix_str withString:@"$"];
|
|
|
+ double f = [[formatter numberFromString:text] doubleValue]*0.9;
|
|
|
+ newvalue = [formatter stringFromNumber:[NSNumber numberWithDouble: f]];
|
|
|
+ newvalue=[newvalue stringByReplacingOccurrencesOfString:@"$" withString:prefix_str];
|
|
|
+ // newvalue = [NSString stringWithFormat:@"$ %.2f",f];
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"value"] = newvalue;
|
|
|
+ self.page_controlTemplate [control[@"control"] ][@"dirty"] = [NSNumber numberWithBool:true];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ tv.text = newvalue;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- tv.text = newvalue;
|
|
|
-
|
|
|
+ else if([action[@"type"] isEqualToString:@"change contract"] )
|
|
|
+ {
|
|
|
+ NSString* pdf = action[@"contract"];
|
|
|
+ if(self.chg_Contract)
|
|
|
+ self.chg_Contract(pdf);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|