- (int) getRemainDate
{
NSArray* arrayTemp=[m_strDueDate componentsSeparatedByString:@"~"];
NSLog(@"사용기간 : %@", [arrayTemp objectAtIndex:1]);
NSString* strDate;
strDate=[arrayTemp objectAtIndex:1];
strDate=[strDate stringByReplacingOccurrencesOfString:@"년" withString:@"-"];
strDate=[strDate stringByReplacingOccurrencesOfString:@"월" withString:@"-"];
strDate=[strDate stringByReplacingOccurrencesOfString:@"일" withString:@""];
strDate=[strDate stringByReplacingOccurrencesOfString:@" " withString:@""];
strDate=[strDate stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
strDate=[strDate stringByAppendingString:@" 23:59:59 +0900"];
NSLog(@"string count = %d, %@", [strDate length], strDate);
NSDate* today=[NSDate date];
NSString* systemVersion=[[NSString alloc] initWithString:[[UIDevice currentDevice]systemVersion]];
if([systemVersion compare:@"4.1" options:NSCaseInsensitiveSearch]==NSOrderedAscending){
// do nothing
}else{
NSTimeZone* currentTimeZone=[NSTimeZone localTimeZone];
NSInteger currentGMTOffset=[currentTimeZone secondsFromGMT];
today=[today dateByAddingTimeInterval:currentGMTOffset];
}
NSLog(@"today = %@", today);
NSDate* theDate;
theDate=[[NSDate alloc]initWithString:strDate];
NSTimeInterval diff=[theDate timeIntervalSinceDate:today];
int days=diff/60/60/24;
m_nRemainDueDate=days;
[systemVersion release];
[theDate release];
return m_nRemainDueDate;
}
- (void) ChangeBgcolor
{
NSLog(@"%@", m_strHtml);
if(m_nRemainDueDate<0 || m_nBalance==0){
m_strHtml=[m_strHtml stringByReplacingOccurrencesOfString:@"<table width=300 height=380>" withString:@"<table width=300 height=380 bgcolor=gray>"];
[m_strHtml retain];
}else if(m_nRemainDueDate<30 && m_nBalance>0){
//backgroundColor=[UIColor orangeColor];
}else {
//backgroundColor=[UIColor whiteColor];
}
NSLog(@"%@", m_strHtml);
}