|
|
@@ -6011,7 +6011,8 @@
|
|
|
NSDate *date = [formatter dateFromString:dateTime];
|
|
|
|
|
|
formatter.dateFormat = newFormate;
|
|
|
- return [formatter stringFromDate:date];
|
|
|
+ NSString *result = [formatter stringFromDate:date];
|
|
|
+ return result ? result : @"";
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -9773,7 +9774,7 @@
|
|
|
time = [time stringByAppendingString:@" PST"];
|
|
|
|
|
|
|
|
|
- int sheet_id = sqlite3_column_int(stmt, 0);
|
|
|
+ int sheet_id = sqlite3_column_int(stmt, 5);
|
|
|
|
|
|
|
|
|
NSMutableDictionary *item = @{
|
|
|
@@ -9945,4 +9946,55 @@
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|
|
|
|
|
|
++ (NSData *)offline_removePortfolio:(NSMutableDictionary *)params {
|
|
|
+
|
|
|
+ NSString *portfolio_ids = [params objectForKey:@"portfolioId"];
|
|
|
+
|
|
|
+ NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
+
|
|
|
+ sqlite3 *db = [iSalesDB get_db];
|
|
|
+
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"delete from offline_portfolio where item_id in (%@);",portfolio_ids];
|
|
|
+
|
|
|
+ int result = [iSalesDB execSql:sql db:db];
|
|
|
+
|
|
|
+ [dic setObject:[NSNumber numberWithInt:result] forKey:@"result"];
|
|
|
+ [dic setObject:@"Regular Mode" forKey:@"mode"];
|
|
|
+
|
|
|
+ int count = [iSalesDB get_recordcount:db table:@"offline_portfolio" where:@"1=1"];
|
|
|
+
|
|
|
+ [dic setObject:[NSNumber numberWithInt:count] forKey:@"portfolio_count"];
|
|
|
+
|
|
|
+ [iSalesDB close_db:db];
|
|
|
+
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
++ (NSData *)offline_removePDF:(NSMutableDictionary *)params {
|
|
|
+
|
|
|
+ NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
+
|
|
|
+ NSInteger tearsheetsId = [[params objectForKey:@"tearsheetsId"] integerValue];
|
|
|
+ NSString *user = [params objectForKey:@"user"];
|
|
|
+
|
|
|
+ NSString *create_user = [iSalesDB jk_queryText:[NSString stringWithFormat:@"select create_user from offline_pdf where tearsheets_id = %d;",tearsheetsId]];
|
|
|
+ if (![create_user isEqualToString:user]) {
|
|
|
+ [dic setObject:[NSNumber numberWithInt:RESULT_FALSE] forKey:@"result"];
|
|
|
+ [dic setObject:@"Regular Mode" forKey:@"mode"];
|
|
|
+ [dic setObject:@"Only Delete Your Owns" forKey:@"err_msg"];
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"delete from offline_pdf where tearsheets_id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
|
|
|
+
|
|
|
+
|
|
|
+ int result = [iSalesDB execSql:sql];
|
|
|
+
|
|
|
+ [dic setObject:[NSNumber numberWithInt:result] forKey:@"result"];
|
|
|
+ [dic setObject:@"Regular Mode" forKey:@"mode"];
|
|
|
+
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
+}
|
|
|
+
|
|
|
@end
|