Просмотр исходного кода

修改PDF保存,增加Regular Price和PDF生成参数。

Pen Li 9 лет назад
Родитель
Сommit
5ad6395fc3

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 17 - 5
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -10233,11 +10233,12 @@
         double percent = sqlite3_column_double(stmt, 7);
         
         NSString *price_null = [self textAtColumn:3 statement:stmt];
-        if ([price_null isEqualToString:@"null"]) {
+/*        if ([price_null isEqualToString:@"null"]) {
             price = [[self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db] doubleValue];
         }
-        
-        
+*/
+        int regular_price = [[params objectForKey:@"regular_price"] integerValue];
+        NSString *regular_price_str = [self get_portfolio_price:appDelegate.contact_id item_id:item_id price:regular_price db:db];
         
         NSMutableDictionary *item = @{
                                       @"linenotes": line_note,
@@ -10246,8 +10247,17 @@
                                       @"available_percent" : @(percent),
                                       @"item_id": [NSString stringWithFormat:@"%d",item_id],
                                       @"tear_sheet_discount": [NSString stringWithFormat:@"%f",discount],
-                                      @"tear_sheet_price": [NSString stringWithFormat:@"%f",price]
+                                      @"regular_price" : regular_price_str
                                       }.mutableCopy;
+        
+        if ([price_null isEqualToString:@"null"]) {
+
+            
+            
+        } else {
+            [item setObject:[NSString stringWithFormat:@"%f",price] forKey:@"special_price"];
+        }
+        
         if (percentage) {
             [item removeObjectForKey:@"available_qty"];
         } else {
@@ -10316,8 +10326,10 @@
     pdf_path = [newPath lastPathComponent];
     
     // 保存信息
+    NSString *off_params = [RAUtils dict2string:params];
+    off_params = [self translateSingleQuote:off_params];
     
-    NSString *save_pdf_sql = [NSString stringWithFormat:@"insert into offline_pdf (tearsheets_id,pdf_path,create_user,tear_note,tear_name,model_info,configureParams,is_local) values ((select ifnull(max(tearsheets_id),0) from offline_pdf) + 1,'%@','%@','%@','%@','%@','%@',1);",pdf_path,create_user,tear_note,tear_name,model_info,configureParams];
+    NSString *save_pdf_sql = [NSString stringWithFormat:@"insert into offline_pdf (tearsheets_id,pdf_path,create_user,tear_note,tear_name,model_info,configureParams,is_local,off_params) values ((select ifnull(max(tearsheets_id),0) from offline_pdf) + 1,'%@','%@','%@','%@','%@','%@',1,'%@');",pdf_path,create_user,tear_note,tear_name,model_info,configureParams,off_params];
     
     int result = [iSalesDB execSql:save_pdf_sql];