RootViewController.m 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. //
  2. // ViewController.m
  3. // AntsContract
  4. //
  5. // Created by Ray on 12/16/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "RootViewController.h"
  9. #import "DocumentPageViewController.h"
  10. #import "LoginViewController.h"
  11. #import "AppDelegate.h"
  12. #import "RAUtils.h"
  13. #import "PDFViewController.h"
  14. #import "DocumentListViewController.h"
  15. #import "PendingDocumentsViewController.h"
  16. #import "ACNetwork.h"
  17. #import "PDFUtils.h"
  18. #import "AddExtDocumentViewController.h"
  19. @interface RootViewController ()
  20. @property (nonatomic,assign) BOOL hasShowLoginView;
  21. @end
  22. @implementation RootViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. self.title= @"eSign";
  26. self.welcomeLabel.text=@"Not sign in";
  27. self.buttonHIC.enabled = false;
  28. self.buttonSRL.enabled = false;
  29. self.coverView.hidden = false;
  30. [self reloadBG];
  31. NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
  32. NSString* build =[infoDict objectForKey:@"CFBundleVersion"];
  33. NSString* version =[infoDict objectForKey:@"CFBundleShortVersionString"];
  34. NSString* versionNum = [NSString stringWithFormat:@"VeS1.%@.%@",version,build];
  35. self.labelVer.text = versionNum;
  36. // Do any additional setup after loading the view, typically from a nib.
  37. }
  38. -(void) viewDidAppear:(BOOL)animated
  39. {
  40. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  41. if(appDelegate.accessMode == AppAccessModeOnline)
  42. {
  43. self.labelMode.text = @"Mode: Online";
  44. [self.switchMode setOn:true];
  45. self.navigationItem.rightBarButtonItem = self.ibSignin;
  46. }
  47. else
  48. {
  49. self.labelMode.text = @"Mode: Offline";
  50. [self.switchMode setOn:false];
  51. self.navigationItem.rightBarButtonItem = nil;
  52. }
  53. if(!appDelegate.bLogin)
  54. [self presentLogin:self.ibSignin];
  55. }
  56. -(void) presentLogin:(id)sender
  57. {
  58. // 确保只Presnet LoginView一次.
  59. if (self.hasShowLoginView) return;
  60. self.hasShowLoginView = YES;
  61. UIBarButtonItem* bbitem = sender;
  62. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  63. {
  64. LoginViewController * loginvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
  65. loginvc.returnValue = ^(bool blogin){
  66. // [self checklogin :true];
  67. self.hasShowLoginView = NO;
  68. if(blogin)
  69. {
  70. self.welcomeLabel.text=[NSString stringWithFormat:@"Welcome %@",appDelegate.user];
  71. [bbitem setTitle:@"Sign out"];
  72. self.buttonHIC.enabled = true;
  73. self.buttonSRL.enabled = true;
  74. self.coverView.hidden = true;
  75. // 处理三方app 传入文件
  76. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  77. if(appDelegate.shareFile)
  78. {
  79. AddExtDocumentViewController * addVC;
  80. addVC = [ [UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"AddExtDocumentViewController"];
  81. addVC.is_present = true;
  82. addVC.doc_number = nil;
  83. addVC.arr_documents = [NSMutableArray arrayWithObjects:appDelegate.shareFile, nil];
  84. appDelegate.shareFile=nil;
  85. // notesVC.docNotes = notes;
  86. UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:addVC] ;
  87. navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
  88. [self presentViewController:navi animated:YES completion:^{
  89. // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  90. DebugLog(@"filter present.........");
  91. // self.btop = false;
  92. // <#code#>
  93. }];
  94. }
  95. }
  96. else
  97. {
  98. appDelegate.shareFile=nil;
  99. self.welcomeLabel.text=@"Not sign in";
  100. self.buttonHIC.enabled = false;
  101. self.buttonSRL.enabled = false;
  102. self.coverView.hidden = false;
  103. }
  104. };
  105. UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
  106. navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
  107. [self presentViewController:navi animated:YES completion:^{
  108. DebugLog(@"login present.........");
  109. }];
  110. }
  111. }
  112. //-(void) leak_debug
  113. //{
  114. //
  115. //
  116. // CGPDFDocumentRef document = [PDFUtils OpenPDF:@"GEIC - Home Improvement Contract 2017.pdf"];
  117. // // self.total_page = CGPDFDocumentGetNumberOfPages (self.document);
  118. //
  119. // NSMutableDictionary * controlTemplate = [self templateInit:[PDFUtils loadControl:@"GEIC - Home Improvement Contract 2017.json"]];
  120. //
  121. //
  122. // NSString* pdffile = [PDFUtils SavePDF:controlTemplate source:document window_rect:CGRectMake(0, 0, 768, 960)];
  123. //
  124. // CGPDFDocumentRelease(document);
  125. //
  126. // // CFRelease(document);
  127. //
  128. // NSString* zipfile=[ACNetwork prepareUploadFile:pdffile json:controlTemplate];
  129. //
  130. // [self previewPDF:pdffile];
  131. //
  132. //
  133. //
  134. //
  135. //
  136. //
  137. //}
  138. //-(NSMutableDictionary*) templateInit:(NSMutableDictionary*) template
  139. //{
  140. //
  141. //
  142. // NSString* temp = NSTemporaryDirectory();
  143. // NSString* filename =[NSString stringWithFormat:@"%@.png", [[NSUUID UUID] UUIDString]];
  144. // NSString* qrpath=[temp stringByAppendingPathComponent:filename];
  145. // UIImage* qrimg=[RAUtils generateBarCode:@"leak test" width:300 height:44];//[QRCodeGenerator qrImageForString:order_code imageSize:240];
  146. // bool bwrite=[UIImagePNGRepresentation(qrimg)writeToFile: qrpath atomically:YES];
  147. //
  148. //
  149. //
  150. // for(int i=0;i<[template[@"count"] intValue];i++)
  151. // {
  152. // NSMutableDictionary* page =template[[NSString stringWithFormat:@"page_%d",i]];
  153. // for(int j=0;j<[page[@"count"] intValue];j++)
  154. // {
  155. // NSMutableDictionary* control =page[[NSString stringWithFormat:@"control_%d",j]];
  156. // NSString* type = control[@"type"];
  157. // NSString* field =control[@"field"];
  158. // if([type isEqualToString:@"Label"])
  159. // {
  160. // if([field isEqualToString:@"doc_number"])
  161. // {
  162. // control[@"value"]= @"leak test";
  163. // }
  164. // }
  165. // else if([type isEqualToString:@"Image"])
  166. // {
  167. // NSString* name =control[@"name"];
  168. // if([name isEqualToString:@"BarCode"])
  169. // {
  170. // if(bwrite)
  171. // control[@"value"]= qrpath;
  172. // }
  173. // }
  174. // else if([type isEqualToString:@"DatePicker"])
  175. // {
  176. // NSString* name =control[@"aname"];
  177. // if([name isEqualToString:@"Today's Date"])
  178. // {
  179. // NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
  180. // [formatter setDateFormat:@"MM/dd/yyyy"];
  181. // NSString* date = [formatter stringFromDate:[NSDate date]] ;
  182. //
  183. // control[@"value"]= date;
  184. // }
  185. // }
  186. // }
  187. // }
  188. // return template;
  189. //}
  190. - (IBAction)onNewCustomerClick:(id)sender {
  191. // [self leak_debug];
  192. // return;
  193. __weak typeof(self) weakSelf = self;
  194. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  195. if(appDelegate.accessMode == AppAccessModeOffline)
  196. {
  197. __block NSString* offline_docnumber =[ACNetwork offline_docnumber];
  198. if(offline_docnumber==nil)
  199. {
  200. [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once." title:@"Create Customer" controller:self] ;
  201. return;
  202. }
  203. DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  204. // dvc.templateName = @"debug.json";
  205. dvc.templatePath = [[NSBundle mainBundle] pathForResource:@"GEIC - Home Improvement Contract 2017 Update.json" ofType:nil];
  206. dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"GEIC - Home Improvement Contract 2017 Update.pdf" ofType:nil];
  207. dvc.docment_id = offline_docnumber;
  208. dvc.OnSave=^(NSString* file, NSString* subject)
  209. {
  210. [weakSelf previewPDF:file title:offline_docnumber subject:subject];
  211. };
  212. [self.navigationController pushViewController:dvc animated:true];
  213. }
  214. else
  215. {
  216. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Create customer"];
  217. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  218. NSMutableDictionary* json=[[ACNetwork new_document] mutableCopy];
  219. dispatch_async(dispatch_get_main_queue(), ^{
  220. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  221. if([json[@"result"] intValue]==RESULT_TRUE)
  222. {
  223. DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  224. // dvc.templateName = @"debug.json";
  225. dvc.templatePath = [[NSBundle mainBundle] pathForResource:@"GEIC - Home Improvement Contract 2017 Update.json" ofType:nil];
  226. dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"GEIC - Home Improvement Contract 2017 Update.pdf" ofType:nil]; dvc.docment_id = json[@"doc_number"];
  227. dvc.OnSave=^(NSString* file, NSString* subject)
  228. {
  229. [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
  230. };
  231. [self.navigationController pushViewController:dvc animated:true];
  232. }
  233. else
  234. {
  235. // [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Create Customer" controller:self] ;
  236. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
  237. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  238. __block NSString* offline_docnumber =[ACNetwork offline_docnumber];
  239. if(offline_docnumber==nil)
  240. {
  241. [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once." title:@"Create Customer" controller:self] ;
  242. return;
  243. }
  244. [appDelegate SwitchToOffline:appDelegate.user];
  245. DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  246. // dvc.templateName = @"debug.json";
  247. dvc.templatePath = [[NSBundle mainBundle] pathForResource:@"GEIC - Home Improvement Contract 2017 Update.json" ofType:nil];
  248. dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"GEIC - Home Improvement Contract 2017 Update.pdf" ofType:nil];
  249. dvc.docment_id = offline_docnumber;
  250. dvc.OnSave=^(NSString* file, NSString* subject)
  251. {
  252. [weakSelf previewPDF:file title:offline_docnumber subject:subject];
  253. };
  254. [self.navigationController pushViewController:dvc animated:true];
  255. }];
  256. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  257. DebugLog(@"Cancel");
  258. }];
  259. [alertControl addAction:actionOne];
  260. [alertControl addAction:alertthree];
  261. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  262. [self presentViewController:alertControl animated:YES completion:nil];
  263. }
  264. });
  265. });
  266. }
  267. }
  268. - (IBAction)onCustomerPerDocClick:(id)sender {
  269. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  270. if(appDelegate.accessMode == AppAccessModeOffline)
  271. {
  272. [RAUtils message_alert:@"You can only access this function onder online mode." title:@"Offline mode." controller:self];
  273. return;
  274. }
  275. DocumentListViewController* docVC =[self.storyboard instantiateViewControllerWithIdentifier:@"DocumentListViewController" ];
  276. [self.navigationController pushViewController:docVC animated:true];
  277. }
  278. - (IBAction)onPendingDocClick:(id)sender {
  279. PendingDocumentsViewController* docVC =[self.storyboard instantiateViewControllerWithIdentifier:@"PendingDocumentsViewController" ];
  280. [self.navigationController pushViewController:docVC animated:true];
  281. }
  282. - (IBAction)onModeSwitch:(id)sender {
  283. UISwitch* sw = sender;
  284. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  285. NSString * user = [AESCrypt decrypt:[defaults stringForKey:@"user"] password:@"usai"];
  286. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  287. if(sw.isOn)
  288. {
  289. self.navigationItem.rightBarButtonItem = self.ibSignin;
  290. self.labelMode.text = @"Mode: Online";
  291. [appDelegate Logout];
  292. [self presentLogin:self.ibSignin];
  293. //
  294. // [self.switchMode setOn:true];
  295. }
  296. else
  297. {
  298. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Enter user name for offline mode." message:nil preferredStyle:UIAlertControllerStyleAlert];
  299. [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
  300. textField.text = user;
  301. textField.keyboardType=UIKeyboardTypeDefault;
  302. textField.delegate = nil;
  303. }];
  304. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  305. UITextField *name = alertControl.textFields.firstObject;
  306. if(name.text.length==0)
  307. {
  308. self.navigationItem.rightBarButtonItem = self.ibSignin;
  309. [sw setOn: true];
  310. [RAUtils message_alert:@"User name is required." title:@"Can not switch to offline mode." controller:self];
  311. }
  312. else
  313. {
  314. self.navigationItem.rightBarButtonItem = nil;
  315. self.labelMode.text = @"Mode: Offline";
  316. [appDelegate SwitchToOffline:name.text];
  317. self.welcomeLabel.text=[NSString stringWithFormat:@"Welcome %@",appDelegate.user];
  318. self.coverView.hidden = true;
  319. }
  320. }];
  321. // [alertControl addAction:actionOne];
  322. [alertControl addAction:alertthree];
  323. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  324. [sw setOn: true];
  325. }];
  326. [alertControl addAction:alertcancel];
  327. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  328. [self presentViewController:alertControl animated:YES completion:nil];
  329. // [self.switchMode setOn:false];
  330. }
  331. }
  332. - (void)didReceiveMemoryWarning {
  333. [super didReceiveMemoryWarning];
  334. // Dispose of any resources that can be recreated.
  335. }
  336. -(void) reloadBG
  337. {
  338. UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
  339. switch (orientation) {
  340. case UIInterfaceOrientationPortrait:
  341. case UIInterfaceOrientationPortraitUpsideDown:
  342. {
  343. self.coverBG.image = [UIImage imageNamed:@"home_bg_p"];
  344. self.imageBG.image = [UIImage imageNamed:@"home_bg_p"];
  345. break;
  346. }
  347. case UIInterfaceOrientationLandscapeLeft:
  348. case UIInterfaceOrientationLandscapeRight:
  349. {
  350. self.coverBG.image = [UIImage imageNamed:@"home_bg_l"];
  351. self.imageBG.image = [UIImage imageNamed:@"home_bg_l"];
  352. break;
  353. }
  354. default:
  355. self.coverBG.image = [UIImage imageNamed:@"home_bg_p"];
  356. self.imageBG.image = [UIImage imageNamed:@"home_bg_p"];
  357. break;
  358. }
  359. }
  360. -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
  361. {
  362. [self reloadBG];
  363. // [self initControl];
  364. // // [self.pdfPageView setNeedsLayout];
  365. // [self.pdfPageView setNeedsDisplay];
  366. // // UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
  367. //
  368. // // UIApplication * app = [UIApplication sharedApplication];
  369. // // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  370. // // [appDelegate didRotated];
  371. //
  372. // // if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
  373. // // {
  374. // // self.orientation = orientation;
  375. // // [self.collectionview.collectionViewLayout invalidateLayout];
  376. // // DebugLog(@"routed");
  377. // // }
  378. }
  379. - (void)dealWithUILogout {
  380. self.welcomeLabel.text=@"Not sign in";
  381. // [sender setTitle:@"Sign in" forState:UIControlStateNormal];
  382. [self.ibSignin setTitle:@"Sign in"];
  383. self.buttonHIC.enabled = false;
  384. self.buttonSRL.enabled = false;
  385. self.coverView.hidden = false;
  386. }
  387. - (IBAction)OnSigninClick:(id)sender {
  388. UIBarButtonItem* bbitem = sender;
  389. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  390. if(appDelegate.bLogin)
  391. {
  392. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to sign out?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  393. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  394. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign out"];
  395. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  396. NSDictionary* logout_json = nil;
  397. logout_json = [ACNetwork logout];
  398. dispatch_async(dispatch_get_main_queue(), ^{
  399. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  400. if([[logout_json valueForKey:@"result"] intValue]==2)
  401. {
  402. self.welcomeLabel.text=@"Not sign in";
  403. // [sender setTitle:@"Sign in" forState:UIControlStateNormal];
  404. [bbitem setTitle:@"Sign in"];
  405. self.buttonHIC.enabled = false;
  406. self.buttonSRL.enabled = false;
  407. self.coverView.hidden = false;
  408. }
  409. else
  410. {
  411. [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
  412. }
  413. });
  414. });
  415. }];
  416. // [alertControl addAction:actionOne];
  417. [alertControl addAction:alertthree];
  418. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  419. }];
  420. [alertControl addAction:alertcancel];
  421. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  422. [self presentViewController:alertControl animated:YES completion:nil];
  423. }
  424. else
  425. [self presentLogin:sender];
  426. }
  427. -(void) previewPDF:(NSString*)file title:(NSString*)title subject:(NSString*)subject
  428. {
  429. // return;
  430. NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
  431. NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
  432. bool isLocalFile= true;//[self.content_data[indexPath.row] valueForKey:@"isLocalFile"];
  433. PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
  434. ViewController.url = url;
  435. ViewController.canSave = false;
  436. ViewController.isLocalfile=isLocalFile;
  437. ViewController.defaultStyle = true;
  438. ViewController.save_name=title;
  439. ViewController.title = title;
  440. // NSString* subject;
  441. // if (company.length==0) {
  442. // NSString* cur_time =[RAUtils current_date];
  443. // subject =name;//[NSString stringWithFormat:@"NPD Product List %@",cur_time];
  444. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  445. // NSString* customer_email= [appDelegate.customerInfo valueForKey:@"customer_email"];
  446. NSMutableArray* send_to = [[NSMutableArray alloc]init];
  447. // if(customer_email.length>0)
  448. // {
  449. // send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
  450. // // customer_email compo
  451. // // [send_to addObject:customer_email];
  452. // }
  453. ViewController.mail_to = send_to;
  454. // }
  455. // else
  456. // {
  457. // subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
  458. // }
  459. // ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
  460. ViewController.mail_subject = subject;
  461. ViewController.hidenavi = false;
  462. [self.navigationController pushViewController:ViewController animated:YES];
  463. }
  464. //- (IBAction)OnHICClick:(id)sender {
  465. //
  466. //
  467. // __weak typeof(self) weakSelf = self;
  468. //
  469. //
  470. // DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  471. //
  472. // dvc.templateName = @"GEIC - Home Improvement Contract 2016.json";
  473. // dvc.pdfName = @"GEIC - Home Improvement Contract 2017.pdf";
  474. //
  475. // dvc.OnSave=^(NSString* file)
  476. // {
  477. // // [weakSelf previewPDF:file];
  478. // };
  479. //
  480. // [self.navigationController pushViewController:dvc animated:true];
  481. //}
  482. //- (IBAction)OnSRLClick:(id)sender {
  483. //
  484. // DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  485. //
  486. // dvc.templateName = @"SUBCONTRACTORS REFERRAL LIST.json";
  487. // dvc.pdfName = @"SUBCONTRACTORS REFERRAL LIST.pdf";
  488. // dvc.OnSave=^(NSString* file)
  489. // {
  490. //
  491. // //[self previewPDF:file];
  492. // };
  493. //
  494. // [self.navigationController pushViewController:dvc animated:true];
  495. //}
  496. @end