RootViewController.m 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  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.ibSignin setTitle:@"Sign in"];
  293. [self presentLogin:self.ibSignin];
  294. //
  295. // [self.switchMode setOn:true];
  296. }
  297. else
  298. {
  299. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Enter user name for offline mode." message:nil preferredStyle:UIAlertControllerStyleAlert];
  300. [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
  301. textField.text = user;
  302. textField.keyboardType=UIKeyboardTypeDefault;
  303. textField.delegate = nil;
  304. }];
  305. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  306. UITextField *name = alertControl.textFields.firstObject;
  307. if(name.text.length==0)
  308. {
  309. self.navigationItem.rightBarButtonItem = self.ibSignin;
  310. [sw setOn: true];
  311. [RAUtils message_alert:@"User name is required." title:@"Can not switch to offline mode." controller:self];
  312. }
  313. else
  314. {
  315. self.navigationItem.rightBarButtonItem = nil;
  316. self.labelMode.text = @"Mode: Offline";
  317. [appDelegate SwitchToOffline:name.text];
  318. self.welcomeLabel.text=[NSString stringWithFormat:@"Welcome %@",appDelegate.user];
  319. self.coverView.hidden = true;
  320. }
  321. }];
  322. // [alertControl addAction:actionOne];
  323. [alertControl addAction:alertthree];
  324. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  325. [sw setOn: true];
  326. }];
  327. [alertControl addAction:alertcancel];
  328. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  329. [self presentViewController:alertControl animated:YES completion:nil];
  330. // [self.switchMode setOn:false];
  331. }
  332. }
  333. - (void)didReceiveMemoryWarning {
  334. [super didReceiveMemoryWarning];
  335. // Dispose of any resources that can be recreated.
  336. }
  337. -(void) reloadBG
  338. {
  339. UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
  340. switch (orientation) {
  341. case UIInterfaceOrientationPortrait:
  342. case UIInterfaceOrientationPortraitUpsideDown:
  343. {
  344. self.coverBG.image = [UIImage imageNamed:@"home_bg_p"];
  345. self.imageBG.image = [UIImage imageNamed:@"home_bg_p"];
  346. break;
  347. }
  348. case UIInterfaceOrientationLandscapeLeft:
  349. case UIInterfaceOrientationLandscapeRight:
  350. {
  351. self.coverBG.image = [UIImage imageNamed:@"home_bg_l"];
  352. self.imageBG.image = [UIImage imageNamed:@"home_bg_l"];
  353. break;
  354. }
  355. default:
  356. self.coverBG.image = [UIImage imageNamed:@"home_bg_p"];
  357. self.imageBG.image = [UIImage imageNamed:@"home_bg_p"];
  358. break;
  359. }
  360. }
  361. -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
  362. {
  363. [self reloadBG];
  364. // [self initControl];
  365. // // [self.pdfPageView setNeedsLayout];
  366. // [self.pdfPageView setNeedsDisplay];
  367. // // UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
  368. //
  369. // // UIApplication * app = [UIApplication sharedApplication];
  370. // // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  371. // // [appDelegate didRotated];
  372. //
  373. // // if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
  374. // // {
  375. // // self.orientation = orientation;
  376. // // [self.collectionview.collectionViewLayout invalidateLayout];
  377. // // DebugLog(@"routed");
  378. // // }
  379. }
  380. - (void)dealWithUILogout {
  381. self.welcomeLabel.text=@"Not sign in";
  382. // [sender setTitle:@"Sign in" forState:UIControlStateNormal];
  383. [self.ibSignin setTitle:@"Sign in"];
  384. self.buttonHIC.enabled = false;
  385. self.buttonSRL.enabled = false;
  386. self.coverView.hidden = false;
  387. }
  388. - (IBAction)OnSigninClick:(id)sender {
  389. UIBarButtonItem* bbitem = sender;
  390. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  391. if(appDelegate.bLogin)
  392. {
  393. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to sign out?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  394. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  395. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign out"];
  396. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  397. NSDictionary* logout_json = nil;
  398. logout_json = [ACNetwork logout];
  399. dispatch_async(dispatch_get_main_queue(), ^{
  400. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  401. if([[logout_json valueForKey:@"result"] intValue]==2)
  402. {
  403. self.welcomeLabel.text=@"Not sign in";
  404. // [sender setTitle:@"Sign in" forState:UIControlStateNormal];
  405. [bbitem setTitle:@"Sign in"];
  406. self.buttonHIC.enabled = false;
  407. self.buttonSRL.enabled = false;
  408. self.coverView.hidden = false;
  409. }
  410. else
  411. {
  412. [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
  413. }
  414. });
  415. });
  416. }];
  417. // [alertControl addAction:actionOne];
  418. [alertControl addAction:alertthree];
  419. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  420. }];
  421. [alertControl addAction:alertcancel];
  422. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  423. [self presentViewController:alertControl animated:YES completion:nil];
  424. }
  425. else
  426. [self presentLogin:sender];
  427. }
  428. -(void) previewPDF:(NSString*)file title:(NSString*)title subject:(NSString*)subject
  429. {
  430. // return;
  431. NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
  432. NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
  433. bool isLocalFile= true;//[self.content_data[indexPath.row] valueForKey:@"isLocalFile"];
  434. PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
  435. ViewController.url = url;
  436. ViewController.canSave = false;
  437. ViewController.isLocalfile=isLocalFile;
  438. ViewController.defaultStyle = true;
  439. ViewController.save_name=title;
  440. ViewController.title = title;
  441. // NSString* subject;
  442. // if (company.length==0) {
  443. // NSString* cur_time =[RAUtils current_date];
  444. // subject =name;//[NSString stringWithFormat:@"NPD Product List %@",cur_time];
  445. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  446. // NSString* customer_email= [appDelegate.customerInfo valueForKey:@"customer_email"];
  447. NSMutableArray* send_to = [[NSMutableArray alloc]init];
  448. // if(customer_email.length>0)
  449. // {
  450. // send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
  451. // // customer_email compo
  452. // // [send_to addObject:customer_email];
  453. // }
  454. ViewController.mail_to = send_to;
  455. // }
  456. // else
  457. // {
  458. // subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
  459. // }
  460. // ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
  461. ViewController.mail_subject = subject;
  462. ViewController.hidenavi = false;
  463. [self.navigationController pushViewController:ViewController animated:YES];
  464. }
  465. //- (IBAction)OnHICClick:(id)sender {
  466. //
  467. //
  468. // __weak typeof(self) weakSelf = self;
  469. //
  470. //
  471. // DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  472. //
  473. // dvc.templateName = @"GEIC - Home Improvement Contract 2016.json";
  474. // dvc.pdfName = @"GEIC - Home Improvement Contract 2017.pdf";
  475. //
  476. // dvc.OnSave=^(NSString* file)
  477. // {
  478. // // [weakSelf previewPDF:file];
  479. // };
  480. //
  481. // [self.navigationController pushViewController:dvc animated:true];
  482. //}
  483. //- (IBAction)OnSRLClick:(id)sender {
  484. //
  485. // DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
  486. //
  487. // dvc.templateName = @"SUBCONTRACTORS REFERRAL LIST.json";
  488. // dvc.pdfName = @"SUBCONTRACTORS REFERRAL LIST.pdf";
  489. // dvc.OnSave=^(NSString* file)
  490. // {
  491. //
  492. // //[self previewPDF:file];
  493. // };
  494. //
  495. // [self.navigationController pushViewController:dvc animated:true];
  496. //}
  497. @end