|
|
@@ -9659,7 +9659,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- NSString *sql = [NSString stringWithFormat:@"select product_id,name,description,ifnull(sheet_price,'null'),sheet_discount,available_qty,percentage,item_id,fashion_id,img,line_note,percent from offline_portfolio order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select product_id,name,description,ifnull(sheet_price,'null'),sheet_discount,ifnull(available_qty,'null'),percentage,item_id,fashion_id,img,line_note,percent from offline_portfolio order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
|
|
|
__block NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
|
|
@@ -9679,7 +9679,7 @@
|
|
|
int qty = sqlite3_column_int(stmt, 5);
|
|
|
int percentage = sqlite3_column_int(stmt, 6);
|
|
|
int item_id = sqlite3_column_int(stmt, 7);
|
|
|
- int fashion_id = sqlite3_column_int(stmt, 8);
|
|
|
+// int fashion_id = sqlite3_column_int(stmt, 8);
|
|
|
NSString *img_path = [self textAtColumn:9 statement:stmt];
|
|
|
NSString *line_note = [self textAtColumn:10 statement:stmt];
|
|
|
double percent = sqlite3_column_double(stmt, 11);
|
|
|
@@ -9689,6 +9689,8 @@
|
|
|
price = [[self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db] doubleValue];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
NSMutableDictionary *item = @{
|
|
|
@"linenotes": line_note,
|
|
|
@"check": @(1),
|
|
|
@@ -9697,7 +9699,7 @@
|
|
|
@"available_percent" : @(percent),
|
|
|
@"description": [NSString stringWithFormat:@"%@\n%@",name,description],
|
|
|
@"item_id": [NSString stringWithFormat:@"%d",item_id],
|
|
|
- @"fashion_id": [NSString stringWithFormat:@"%d",fashion_id],
|
|
|
+ @"fashion_id": [NSString stringWithFormat:@"%d",product_id],
|
|
|
@"img": img_path,
|
|
|
@"tear_sheet_discount": [NSString stringWithFormat:@"%f",discount],
|
|
|
@"tear_sheet_price": [NSString stringWithFormat:@"%f",price]
|
|
|
@@ -9708,6 +9710,11 @@
|
|
|
[item removeObjectForKey:@"available_percent"];
|
|
|
}
|
|
|
|
|
|
+ NSString *qty_null = [self textAtColumn:5 statement:stmt];
|
|
|
+ if ([qty_null isEqualToString:@"null"]) {
|
|
|
+ [item removeObjectForKey:@"available_qty"];
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
[dic setObject:item forKey:[NSString stringWithFormat:@"item_%ld",*count]];
|
|
|
[dic setValue:[NSNumber numberWithLong:++(*count)] forKey:@"count"];
|
|
|
@@ -9744,8 +9751,10 @@
|
|
|
NSString *keyword = [params valueForKey:@"keyWord"];
|
|
|
|
|
|
NSString *where = @"";
|
|
|
+
|
|
|
if (keyword.length) {
|
|
|
-
|
|
|
+ keyword = [self translateSingleQuote:keyword];
|
|
|
+ where = [NSString stringWithFormat:@"where lower(create_user) like '%%%@%%' or lower(tear_note) like '%%%@%%' or lower(tear_name) like '%%%@%%'",keyword.lowercaseString,keyword.lowercaseString,keyword.lowercaseString];
|
|
|
}
|
|
|
|
|
|
NSString *sql = [NSString stringWithFormat:@"select tear_name,tear_note,createtime,create_user,pdf_path,tearsheets_id from offline_pdf %@ order by createtime desc limit %d offset %d;",where,limit,offset];
|
|
|
@@ -9825,4 +9834,39 @@
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|
|
|
|
|
|
++ (NSData *)offline_model_qty:(NSMutableDictionary *)params {
|
|
|
+
|
|
|
+ NSString *product_id = [params objectForKey:@"fashionId"];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select availability from product where product_id = %@;",product_id];
|
|
|
+
|
|
|
+ __block int result = RESULT_TRUE;
|
|
|
+ __block int qty = 0;
|
|
|
+ [iSalesDB jk_query:sql completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
+
|
|
|
+ qty = sqlite3_column_int(stmt, 0);
|
|
|
+
|
|
|
+ } failure:^(NSMutableDictionary *container, NSString *err_msg) {
|
|
|
+ result = RESULT_FALSE;
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSMutableDictionary *dic = @{
|
|
|
+ @"err_msg" : result == RESULT_FALSE ? @"Failed." : @"Success.",
|
|
|
+ @"mode" : @"Regular Mode",
|
|
|
+ @"quantity_available" : @(qty),
|
|
|
+ @"result" : @(result),
|
|
|
+ }.mutableCopy;
|
|
|
+
|
|
|
+
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
++ (NSData *)offline_editPortfolio:(NSMutableDictionary *)params {
|
|
|
+
|
|
|
+ NSMutableDictionary *dic = nil;
|
|
|
+
|
|
|
+ return [RAUtils dict2data:dic];
|
|
|
+}
|
|
|
+
|
|
|
@end
|