|
|
@@ -9864,7 +9864,83 @@
|
|
|
|
|
|
+ (NSData *)offline_editPortfolio:(NSMutableDictionary *)params {
|
|
|
|
|
|
- NSMutableDictionary *dic = nil;
|
|
|
+ NSString *item_ids = [params objectForKey:@"item_id"];
|
|
|
+ NSString *line_notes = [params objectForKey:@"notes"];
|
|
|
+ NSString *price_str = [params objectForKey:@"price"];
|
|
|
+ NSString *discount_str = [params objectForKey:@"discount"];
|
|
|
+ NSString *percent = [params objectForKey:@"available_percent"];
|
|
|
+ NSString *qty = [params objectForKey:@"available_qty"];
|
|
|
+
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"update offline_portfolio set "];
|
|
|
+ int dot = 0;
|
|
|
+
|
|
|
+ if (line_notes) {
|
|
|
+ line_notes = [self translateSingleQuote:line_notes];
|
|
|
+ line_notes = [NSString stringWithFormat:@"line_note = '%@'",line_notes];
|
|
|
+ sql = [sql stringByAppendingString:line_notes];
|
|
|
+ dot = 1;
|
|
|
+ } else {
|
|
|
+ line_notes = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (price_str) {
|
|
|
+ if (dot) {
|
|
|
+ price_str = [NSString stringWithFormat:@",sheet_price = %@",price_str];
|
|
|
+ } else {
|
|
|
+ price_str = [NSString stringWithFormat:@"sheet_price = %@",price_str];
|
|
|
+ dot = 1;
|
|
|
+ }
|
|
|
+ sql = [sql stringByAppendingString:price_str];
|
|
|
+ } else {
|
|
|
+ price_str = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (discount_str) {
|
|
|
+ if (dot) {
|
|
|
+ discount_str = [NSString stringWithFormat:@",sheet_discount = %@",discount_str];
|
|
|
+ } else {
|
|
|
+ discount_str = [NSString stringWithFormat:@"sheet_discount = %@",discount_str];
|
|
|
+ dot = 1;
|
|
|
+ }
|
|
|
+ sql = [sql stringByAppendingString:discount_str];
|
|
|
+ } else {
|
|
|
+ discount_str = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (percent) {
|
|
|
+ if (dot) {
|
|
|
+ percent = [NSString stringWithFormat:@",percent = %@,percentage = 1",percent];
|
|
|
+ } else {
|
|
|
+ percent = [NSString stringWithFormat:@"percent = %@,percentage = 1",percent];
|
|
|
+ dot = 1;
|
|
|
+ }
|
|
|
+ sql = [sql stringByAppendingString:percent];
|
|
|
+ } else {
|
|
|
+ percent = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (qty) {
|
|
|
+ if (dot) {
|
|
|
+ qty = [NSString stringWithFormat:@",available_qty = %@,percentage = 0",qty];
|
|
|
+ } else {
|
|
|
+ qty = [NSString stringWithFormat:@"available_qty = %@,percentage = 0",qty];
|
|
|
+ dot = 1;
|
|
|
+ }
|
|
|
+ sql = [sql stringByAppendingString:qty];
|
|
|
+ } else {
|
|
|
+ qty = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *where = [NSString stringWithFormat:@" where item_id in (%@);",item_ids];
|
|
|
+ sql = [sql stringByAppendingString:where];
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
+
|
|
|
+ int result = [iSalesDB execSql:sql];
|
|
|
+
|
|
|
+ [dic setObject:[NSNumber numberWithInt:result] forKey:@"result"];
|
|
|
+ [dic setObject:@"Regular Mode" forKey:@"mode"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|