|
|
@@ -380,9 +380,10 @@
|
|
|
// [send_to addObject:customer_email];
|
|
|
}
|
|
|
ViewController.mail_to = send_to;
|
|
|
+ NSString* subject = nil;
|
|
|
|
|
|
#ifdef BUILD_NPD
|
|
|
- NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from NEW PACIFIC DIRECT,INC.",company,so];
|
|
|
+ subject=[NSString stringWithFormat:@"%@ -- SO# %@ from NEW PACIFIC DIRECT,INC.",company,so];
|
|
|
|
|
|
if (appDelegate.user_type == USER_ROLE_CUSTOMER&&self.is_shoporder) {
|
|
|
NSString *companyName = [appDelegate.customerInfo objectForKey:@"customer_name"];
|
|
|
@@ -391,7 +392,16 @@
|
|
|
#endif
|
|
|
|
|
|
#ifdef BUILD_HOMER
|
|
|
- NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,so];
|
|
|
+ subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,so];
|
|
|
+
|
|
|
+ if (appDelegate.user_type == USER_ROLE_CUSTOMER&&self.is_shoporder) {
|
|
|
+ NSString *companyName = [appDelegate.customerInfo objectForKey:@"customer_name"];
|
|
|
+ subject=[NSString stringWithFormat:@"%@ -- SO# %@ from %@",company,so,companyName];
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ subject=[NSString stringWithFormat:@"%@ -- SO# %@ from HOMELEGANCE LA, INC.",company,so];
|
|
|
|
|
|
if (appDelegate.user_type == USER_ROLE_CUSTOMER&&self.is_shoporder) {
|
|
|
NSString *companyName = [appDelegate.customerInfo objectForKey:@"customer_name"];
|
|
|
@@ -401,7 +411,7 @@
|
|
|
|
|
|
#ifdef BUILD_HMLG
|
|
|
|
|
|
- NSString* subject=[NSString stringWithFormat:@"%@ -- SO# %@ from Homelegance.",company,so];
|
|
|
+ subject=[NSString stringWithFormat:@"%@ -- SO# %@ from Homelegance.",company,so];
|
|
|
|
|
|
#endif
|
|
|
|
|
|
@@ -692,6 +702,20 @@
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ int count = [[self.content_data objectForKey:@"count"] intValue];
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
+ NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+ NSMutableDictionary *section = [[self.content_data objectForKey:key] mutableCopy];
|
|
|
+ NSString *type = [section objectForKey:@"type"];
|
|
|
+ if ([type isEqualToString:@"sign_url"]) {
|
|
|
+ [section setObject:img_url_down forKey:@"data"];
|
|
|
+ [self.content_data setObject:section forKey:key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
|
|
|
[self.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
@@ -859,6 +883,19 @@
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ int count = [[self.content_data objectForKey:@"count"] intValue];
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
+ NSString *key = [NSString stringWithFormat:@"section_%d",i];
|
|
|
+ NSMutableDictionary *section = [[self.content_data objectForKey:key] mutableCopy];
|
|
|
+ NSString *type = [section objectForKey:@"type"];
|
|
|
+ if ([type isEqualToString:@"sign_url"]) {
|
|
|
+ [section setObject:img_url_down forKey:@"data"];
|
|
|
+ [self.content_data setObject:section forKey:key];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
#ifdef BUILD_HMLG
|
|
|
[self.content_data setValue:img_url_down forKey:@"sign_url"];
|
|
|
@@ -1319,6 +1356,51 @@
|
|
|
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
|
|
|
+ NSDictionary *data = [section_item objectForKey:@"data"];
|
|
|
+ NSString *type = [section_item objectForKey:@"type"];
|
|
|
+ if ([type isEqualToString:@"order_info"]) {
|
|
|
+
|
|
|
+ float height= self.web_info_height;
|
|
|
+ if(height==0)
|
|
|
+ height=DEF_TABLE_HEIGHT;
|
|
|
+
|
|
|
+ return height;
|
|
|
+
|
|
|
+ } else if ([type isEqualToString:@"sign_url"]) {
|
|
|
+ return 148;
|
|
|
+ } else if ([type isEqualToString:@"more_order_info"]) {
|
|
|
+
|
|
|
+ float height= self.web_moreinfo_height;
|
|
|
+ if(height==0)
|
|
|
+ height=DEF_TABLE_HEIGHT;
|
|
|
+
|
|
|
+ return height;
|
|
|
+
|
|
|
+ } else if ([type isEqualToString:@"sub_order"]) {
|
|
|
+
|
|
|
+ NSDictionary *item = [data objectForKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
|
|
|
+ NSString *item_type = [item objectForKey:@"type"];
|
|
|
+ if ([item_type isEqualToString:@"pick_info"]) {
|
|
|
+ return 218;
|
|
|
+ } else {
|
|
|
+ NSString* notes =[item valueForKey:@"note"];
|
|
|
+ if(notes.length>0)
|
|
|
+ {
|
|
|
+ return 190;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ return 162;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else if ([type isEqualToString:@"price_info"]) {
|
|
|
+ return 44;
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
switch (indexPath.section) {
|
|
|
case 0:
|
|
|
@@ -1522,6 +1604,50 @@
|
|
|
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]];
|
|
|
+ NSString *title = [section_item objectForKey:@"title"];
|
|
|
+ labeltitle = title;
|
|
|
+ if ([title isEqualToString:@"More Info"]) {
|
|
|
+
|
|
|
+ NSString* btntitle=nil ;
|
|
|
+ if(self.showMore)
|
|
|
+ {
|
|
|
+ btntitle=@"Hide";
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ btntitle=@"Show";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
|
|
|
+ btn.tag=section;
|
|
|
+ [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [btn setTitle:btntitle forState:UIControlStateNormal];
|
|
|
+ btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
|
|
|
+ [myView addSubview:btn];
|
|
|
+
|
|
|
+ } else if ([title containsString:@"Models"]) {
|
|
|
+
|
|
|
+ BOOL item_switch = [[section_item objectForKey:@"switch"] boolValue];
|
|
|
+ NSString *normalTitle = @"Show";
|
|
|
+ NSString *selectedTitle = @"Hide";
|
|
|
+ if (item_switch == YES) {
|
|
|
+ normalTitle = @"Hide";
|
|
|
+ selectedTitle = @"Show";
|
|
|
+ }
|
|
|
+
|
|
|
+ UIButton * btn =[[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width-50-15, 0, 50, 33)];
|
|
|
+ btn.tag=section;
|
|
|
+ [btn addTarget:self action:@selector(HideSction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [btn setTitle:normalTitle forState:UIControlStateNormal];
|
|
|
+ [btn setTitle:selectedTitle forState:UIControlStateSelected];
|
|
|
+ btn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
|
|
|
+ [myView addSubview:btn];
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
switch (section) {
|
|
|
case 0:
|
|
|
@@ -1672,6 +1798,35 @@
|
|
|
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ NSUInteger section = sender.tag;
|
|
|
+ NSMutableDictionary *section_item = [[self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]] mutableCopy];
|
|
|
+ NSString *title = [section_item objectForKey:@"title"];
|
|
|
+
|
|
|
+ if ([title isEqualToString:@"More Info"]) {
|
|
|
+
|
|
|
+ self.showMore = !self.showMore;
|
|
|
+ NSRange range = NSMakeRange(section, 1);
|
|
|
+ NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
|
|
|
+ [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
|
+
|
|
|
+ } else if ([title containsString:@"Models"]) {
|
|
|
+
|
|
|
+ BOOL item_switch = [[section_item objectForKey:@"switch"] boolValue];
|
|
|
+ if (item_switch == YES) {
|
|
|
+ [section_item setObject:@(NO) forKey:@"switch"];
|
|
|
+ } else {
|
|
|
+ [section_item setObject:@(YES) forKey:@"switch"];
|
|
|
+ }
|
|
|
+ [self.content_data setObject:section_item forKey:[NSString stringWithFormat:@"section_%ld",section]];
|
|
|
+
|
|
|
+ sender.selected = !sender.selected;
|
|
|
+ NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndex:section];
|
|
|
+ [self.detailTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
|
|
|
switch (sender.tag) {
|
|
|
@@ -1731,6 +1886,10 @@
|
|
|
return [[self.content_data objectForKey:@"count"] integerValue];
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ return [[self.content_data objectForKey:@"count"] integerValue];
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
return 4;
|
|
|
#endif
|
|
|
@@ -1813,6 +1972,42 @@
|
|
|
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+
|
|
|
+ NSDictionary *section_item = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",section]];
|
|
|
+ NSDictionary *data = [section_item objectForKey:@"data"];
|
|
|
+ NSString *section_type = [section_item objectForKey:@"type"];
|
|
|
+ if ([section_type isEqualToString:@"sub_order"]) {
|
|
|
+
|
|
|
+ BOOL item_switch = [[section_item objectForKey:@"switch"] boolValue];
|
|
|
+ if (item_switch == YES) {
|
|
|
+ return [[data objectForKey:@"count"] integerValue];
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else if ([section_type isEqualToString:@"order_info"]){
|
|
|
+ if (self.showModels) {
|
|
|
+ return 1;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } else if ([section_type isEqualToString:@"sign_url"]){
|
|
|
+ return 1;
|
|
|
+ } else if ([section_type isEqualToString:@"more_order_info"]){
|
|
|
+ if(self.showMore)
|
|
|
+ return 1;
|
|
|
+ else
|
|
|
+ return 0;
|
|
|
+ }else if ([section_type isEqualToString:@"price_info"]){
|
|
|
+ return [[data objectForKey:@"count"] integerValue];
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
|
|
|
// NSDictionary * item_json = [self.content_data objectForKey:@"items"];
|
|
|
@@ -1844,6 +2039,10 @@
|
|
|
return 6;
|
|
|
#endif
|
|
|
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ return 6;
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef BUILD_HMLG
|
|
|
return 4;
|
|
|
#endif
|
|
|
@@ -2565,38 +2764,391 @@
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-#ifdef BUILD_HMLG
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ /**
|
|
|
+ * ver1.90
|
|
|
+ */
|
|
|
+ NSDictionary *section = [self.content_data objectForKey:[NSString stringWithFormat:@"section_%ld",indexPath.section]];
|
|
|
+ NSString *type = [section objectForKey:@"type"];
|
|
|
|
|
|
- switch(indexPath.section)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- {
|
|
|
+ if ([type isEqualToString:@"order_info"]) {/** Order Info */
|
|
|
+
|
|
|
+ NSString *CellIdentifier = @"OrderDetailHtmlCell";
|
|
|
+ OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ cell.webview.tag = indexPath.section;
|
|
|
+
|
|
|
+ cell.webview.delegate = self;
|
|
|
+ // cell.webView.scrollView.contentSize.height = 0;
|
|
|
+ cell.webview.scrollView.bounces=NO;
|
|
|
+ cell.webview.scrollView.directionalLockEnabled = true;
|
|
|
+ CGSize size= cell.webview.scrollView.contentSize;
|
|
|
+ size.height=10;
|
|
|
+ cell.webview.scrollView.contentSize=size;
|
|
|
+
|
|
|
+ [cell.webview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
|
|
|
+
|
|
|
+ cell.backgroundColor = [UIColor whiteColor];
|
|
|
+ return cell;
|
|
|
+ } else if ([type isEqualToString:@"sign_url"]) { /** Sign */
|
|
|
+
|
|
|
+
|
|
|
+ NSString *CellIdentifier = @"OrderDetailSignatureCell";
|
|
|
+ OrderDetailSignatureCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+ NSString* img_url = [section valueForKey:@"data"];
|
|
|
+
|
|
|
+ cell.sign_img.userInteractionEnabled = NO;
|
|
|
+ __block BOOL hasTapGesture = NO;
|
|
|
+ [cell.sign_img.gestureRecognizers enumerateObjectsUsingBlock:^(__kindof UIGestureRecognizer * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
|
|
- if(indexPath.row==0)
|
|
|
- {
|
|
|
- NSString *CellIdentifier = @"OrderDetailHtmlCell";
|
|
|
- OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- cell.webview.tag = indexPath.section;
|
|
|
-
|
|
|
- cell.webview.delegate = self;
|
|
|
- // cell.webView.scrollView.contentSize.height = 0;
|
|
|
- cell.webview.scrollView.bounces=NO;
|
|
|
- cell.webview.scrollView.directionalLockEnabled = true;
|
|
|
- CGSize size= cell.webview.scrollView.contentSize;
|
|
|
- size.height=10;
|
|
|
- cell.webview.scrollView.contentSize=size;
|
|
|
-
|
|
|
- [cell.webview loadHTMLString:[self.content_data valueForKey:@"order_info"] baseURL:nil];
|
|
|
-
|
|
|
- cell.backgroundColor = [UIColor whiteColor];
|
|
|
- return cell;
|
|
|
- }
|
|
|
- else
|
|
|
+ if ([obj isKindOfClass:[UITapGestureRecognizer class]]) {
|
|
|
+ hasTapGesture = YES;
|
|
|
+ *stop = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ if (!hasTapGesture) {
|
|
|
+ UITapGestureRecognizer *signatureTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onSignOrderClick:)];
|
|
|
+ [cell.sign_img addGestureRecognizer:signatureTap];
|
|
|
+ }
|
|
|
+
|
|
|
+ int status_code = [[self.content_data valueForKey:@"orderStatus"] intValue];
|
|
|
+ bool offline_edit =[[self.content_data valueForKey:@"offline_edit"] boolValue];
|
|
|
+ if(status_code==1) {
|
|
|
+
|
|
|
+ if(appDelegate.offline_mode==false||offline_edit) {
|
|
|
+ cell.sign_img.userInteractionEnabled = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(status_code==0) {
|
|
|
+ if(appDelegate.offline_mode==false||offline_edit) {
|
|
|
+ cell.sign_img.userInteractionEnabled = YES;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSString* file_name=[img_url lastPathComponent];
|
|
|
+ NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
|
|
|
+ if(img_data!=nil)
|
|
|
+ {
|
|
|
+
|
|
|
+ UIImage * img =[UIImage imageWithData:img_data];
|
|
|
+ cell.sign_img.image=img ;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+
|
|
|
+ NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(downloadimg_data!=nil)
|
|
|
+ {
|
|
|
+
|
|
|
+ [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
+
|
|
|
+ UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
+ cell.sign_img.image=img ;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (cell.sign_img.userInteractionEnabled) {
|
|
|
+ cell.sign_img.image=[UIImage imageNamed:@"taptosign_s"];
|
|
|
+ } else {
|
|
|
+ cell.sign_img.image = nil;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ cell.backgroundColor = [UIColor whiteColor];
|
|
|
+ return cell;
|
|
|
+ } else if ([type isEqualToString:@"more_order_info"]) { /** More Info */
|
|
|
+
|
|
|
+ NSString *CellIdentifier = @"OrderDetailHtmlCell";
|
|
|
+ OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ cell.webview.tag = indexPath.section;
|
|
|
+ cell.webview.delegate = self;
|
|
|
+ // cell.webView.scrollView.contentSize.height = 0;
|
|
|
+ cell.webview.scrollView.bounces=NO;
|
|
|
+ cell.webview.scrollView.directionalLockEnabled = true;
|
|
|
+ CGSize size= cell.webview.scrollView.contentSize;
|
|
|
+ size.height=10;
|
|
|
+ cell.webview.scrollView.contentSize=size;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [cell.webview loadHTMLString:[section valueForKey:@"data"] baseURL:nil];
|
|
|
+
|
|
|
+ cell.backgroundColor = [UIColor whiteColor];
|
|
|
+ return cell;
|
|
|
+
|
|
|
+ } else if ([type isEqualToString:@"sub_order"]) { /** Sub Order */
|
|
|
+
|
|
|
+ NSDictionary *data = [section objectForKey:@"data"];
|
|
|
+ NSDictionary *item = [data objectForKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
|
|
|
+ NSString *item_type = [item objectForKey:@"type"];
|
|
|
+
|
|
|
+ if ([item_type isEqualToString:@"pick_info"]) { /** Pick Info */
|
|
|
+
|
|
|
+ NSString *CellIdentifier = @"OrderDetailPickInfoCell";
|
|
|
+ OrderDetailPickInfoCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+
|
|
|
+ NSString *carrier = [item objectForKey:@"delivery_carrier"];
|
|
|
+ NSString *web_url = [item objectForKey:@"delivery_web_url"];
|
|
|
+ NSString *track_number = [item objectForKey:@"tracking_number"];
|
|
|
+ NSString *status = [item objectForKey:@"status"];
|
|
|
+
|
|
|
+ cell.track_number_lb.text = track_number;
|
|
|
+ cell.status_lb.text = status;
|
|
|
+ cell.carrier_lb.text = carrier;
|
|
|
+ cell.url_lb.text = web_url;
|
|
|
+
|
|
|
+ return cell;
|
|
|
+
|
|
|
+ } else if ([item_type isEqualToString:@"order_item"]) { /** Item Info */
|
|
|
+
|
|
|
+ NSString *CellIdentifier = @"OrderDetailModelCell";
|
|
|
+ OrderDetailModelCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+ NSDictionary * item_json = item;
|
|
|
+
|
|
|
+ // int count = [[item_json valueForKey:@"count"] intValue];
|
|
|
+ NSDictionary * combine_json =[item_json objectForKey:@"combine"];
|
|
|
+ cell.bundle_item=combine_json;
|
|
|
+
|
|
|
+ double dprice=0.0;
|
|
|
+
|
|
|
+ if(cell.bundle_item!=nil)
|
|
|
+ {
|
|
|
+ int citem=0;
|
|
|
+
|
|
|
+ int bcount=[[cell.bundle_item valueForKey:@"count"] intValue];
|
|
|
+ for(int bc=0;bc<bcount;bc++)
|
|
|
+ {
|
|
|
+ NSDictionary * bitem = [cell.bundle_item objectForKey:[NSString stringWithFormat:@"item_%d",bc]];
|
|
|
+ int modulus= [[bitem valueForKey:@"modulus"] intValue];
|
|
|
+ citem+= modulus;
|
|
|
+ double uprice= [[bitem valueForKey:@"unit_price"]doubleValue];
|
|
|
+ dprice+= uprice*modulus;
|
|
|
+
|
|
|
+ }
|
|
|
+ if(citem==1)
|
|
|
+ [ cell.buttonBundle setTitle:[NSString stringWithFormat: @"%d bundle item with price of $ %.2f",citem,dprice ]forState:UIControlStateNormal];
|
|
|
+ else
|
|
|
+ [ cell.buttonBundle setTitle:[NSString stringWithFormat: @"%d bundle items with price of $ %.2f",citem,dprice ]forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ cell.buttonBundle.hidden = NO;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cell.buttonBundle.hidden = YES;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSString* img_url = [item_json valueForKey:@"img"];
|
|
|
+ NSString* description = [item_json valueForKey:@"Item Number"];
|
|
|
+
|
|
|
+ NSString* unitprice = [item_json valueForKey:@"The unit price"];
|
|
|
+ NSString* origin_price = [item_json valueForKey:@"origin_price"];
|
|
|
+ NSString* subtotal = [item_json valueForKey:@"Subtotal"];
|
|
|
+ NSString* qty = [item_json valueForKey:@"QTY"];
|
|
|
+ NSString* status = [item_json valueForKey:@"order_item_status"];
|
|
|
+ NSString* notes = [item_json valueForKey:@"note"];
|
|
|
+
|
|
|
+ if(notes.length>0)
|
|
|
+ {
|
|
|
+ cell.noteLabel.text = [@"Note: " stringByAppendingString:[notes stringByReplacingOccurrencesOfString:@"\n" withString:@" "]];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ cell.noteLabel.text = nil;
|
|
|
+ if(appDelegate.can_see_price&&appDelegate.price_hidden==false)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ unitprice=nil;
|
|
|
+ origin_price=nil;
|
|
|
+ subtotal=nil;
|
|
|
+ }
|
|
|
+
|
|
|
+ float duprice = [unitprice floatValue];
|
|
|
+ float dsubtotal = (duprice+dprice)*[qty intValue];
|
|
|
+
|
|
|
+ cell.descriptionLabel.text=description;
|
|
|
+ if(dprice>0)
|
|
|
+ cell.unitpriceLabel.text = [NSString stringWithFormat:@"%.2f+%.2f",duprice,dprice];//unitprice;
|
|
|
+ else
|
|
|
+ cell.unitpriceLabel.text = [NSString stringWithFormat:@"%.2f",duprice];//unitprice;
|
|
|
+ cell.subtotalLabel.text = [NSString stringWithFormat:@"%.2f",dsubtotal];//subtotal;
|
|
|
+ cell.qtyLabel.text = qty;
|
|
|
+ cell.statusLabel.text = status;
|
|
|
+
|
|
|
+
|
|
|
+ cell.labelOldPrice.text = origin_price;
|
|
|
+
|
|
|
+ double discount =[[item_json valueForKey:@"discount"] doubleValue];
|
|
|
+ NSString* discountstr=[NSString stringWithFormat:@"%@%% off", [RAUtils FloatFormat:discount]];
|
|
|
+ cell.labelDiscount.text = discountstr;
|
|
|
+ bool isfree = [[item_json valueForKey:@"is_free"]boolValue];
|
|
|
+ if(isfree)
|
|
|
+ {
|
|
|
+ cell.labelOldPrice.hidden = false;
|
|
|
+ cell.labelOldPrice.textColor = [UIColor redColor];
|
|
|
+ cell.labelOldPrice.text=@"Free";
|
|
|
+ cell.labelOldPrice.hideline = true;
|
|
|
+
|
|
|
+ cell.labelDiscount.hidden = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cell.labelOldPrice.textColor = [UIColor blackColor];
|
|
|
+ cell.labelOldPrice.hideline = false;
|
|
|
+ if(discount==0)
|
|
|
+ {
|
|
|
+ cell.labelOldPrice.hidden = true;
|
|
|
+ cell.labelDiscount.hidden = true;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cell.labelOldPrice.hidden = false;
|
|
|
+ cell.labelDiscount.hidden = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (![cell.imageName isEqualToString:img_url]) {
|
|
|
+ cell.imageName = img_url;
|
|
|
+ [cell.imgbtn setBackgroundImage:[UIImage imageNamed:@"loading_s"] forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ NSString* file_name=[img_url lastPathComponent];
|
|
|
+ NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
|
|
|
+ if(img_data!=nil)
|
|
|
+ {
|
|
|
+
|
|
|
+ UIImage * img =[UIImage imageWithData:img_data];
|
|
|
+ [cell.imgbtn setBackgroundImage:img forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+
|
|
|
+ NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(downloadimg_data!=nil)
|
|
|
+ {
|
|
|
+
|
|
|
+ [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
+
|
|
|
+ UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
+ [cell.imgbtn setBackgroundImage:img forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ [cell.imgbtn setBackgroundImage:[UIImage imageNamed:@"notfound_s"] forState:UIControlStateNormal];
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ cell.backgroundColor = [UIColor whiteColor];
|
|
|
+ return cell;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else if ([type isEqualToString:@"price_info"]) { /** Price */
|
|
|
+
|
|
|
+ NSString *CellIdentifier = @"OrderDetailPriceCell";
|
|
|
+ OrderDetailPriceCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+
|
|
|
+ NSDictionary *data = [section objectForKey:@"data"];
|
|
|
+ NSDictionary *item = [data objectForKey:[NSString stringWithFormat:@"item_%ld",indexPath.row]];
|
|
|
+ NSString *title = [item objectForKey:@"title"];
|
|
|
+ NSString *value = [item objectForKey:@"value"];
|
|
|
+ if ([title isEqualToString:@"Sub-Total"] || [title isEqualToString:@"Total"]) {
|
|
|
+ if(appDelegate.can_see_price&&appDelegate.price_hidden==false)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ value=nil;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cell.chargeLabel.text = [title stringByAppendingString:@":"];
|
|
|
+ cell.priceLabel.text = value;
|
|
|
+
|
|
|
+ cell.backgroundColor = [UIColor whiteColor];
|
|
|
+ return cell;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+#ifdef BUILD_HMLG
|
|
|
+
|
|
|
+ switch(indexPath.section)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ {
|
|
|
+
|
|
|
+ if(indexPath.row==0)
|
|
|
+ {
|
|
|
+ NSString *CellIdentifier = @"OrderDetailHtmlCell";
|
|
|
+ OrderDetailHtmlCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ cell.webview.tag = indexPath.section;
|
|
|
+
|
|
|
+ cell.webview.delegate = self;
|
|
|
+ // cell.webView.scrollView.contentSize.height = 0;
|
|
|
+ cell.webview.scrollView.bounces=NO;
|
|
|
+ cell.webview.scrollView.directionalLockEnabled = true;
|
|
|
+ CGSize size= cell.webview.scrollView.contentSize;
|
|
|
+ size.height=10;
|
|
|
+ cell.webview.scrollView.contentSize=size;
|
|
|
+
|
|
|
+ [cell.webview loadHTMLString:[self.content_data valueForKey:@"order_info"] baseURL:nil];
|
|
|
+
|
|
|
+ cell.backgroundColor = [UIColor whiteColor];
|
|
|
+ return cell;
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
|
|
|
NSString *CellIdentifier = @"OrderDetailSignatureCell";
|
|
|
@@ -2946,6 +3498,10 @@
|
|
|
cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
|
|
|
cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
|
|
|
#endif
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ cell.chargeLabel.text = @"Liftgate Fee(No loading dock):";
|
|
|
+ cell.priceLabel.text =[self.content_data valueForKey:@"Liftgate Fee(No loading dock)"];
|
|
|
+#endif
|
|
|
|
|
|
#ifdef BUILD_HMLG
|
|
|
cell.chargeLabel.text = @"Tax:";
|
|
|
@@ -2963,6 +3519,10 @@
|
|
|
cell.chargeLabel.text = @"Handling Fee:";
|
|
|
cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
|
|
|
#endif
|
|
|
+#ifdef BUILD_GATIT
|
|
|
+ cell.chargeLabel.text = @"Handling Fee:";
|
|
|
+ cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
|
|
|
+#endif
|
|
|
#ifdef BUILD_HMLG
|
|
|
NSString* price=[self.content_data valueForKey:@"Total"];
|
|
|
if(appDelegate.can_see_price&&appDelegate.price_hidden==false)
|