Преглед изворни кода

修改search、item search、category中where w.is_delete is NULL or w.is_delete != 1;
修改wish_count:is_delete is NULL or is_delete != 1

Pen Li пре 9 година
родитељ
комит
71fc495578

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


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

@@ -687,7 +687,7 @@
     
     NSString* sqlQuery = [NSString stringWithFormat:@"delete from wishlist where _id in (%@);",collectId];
     [iSalesDB execSql:sqlQuery db:db];
-    int count=[iSalesDB get_recordcount:db table:@"wishlist" where:@"1=1"];
+    int count=[iSalesDB get_recordcount:db table:@"wishlist" where:@"is_delete is  NULL or is_delete != 1"];
     [iSalesDB close_db:db];
     
     appDelegate.wish_count =count;
@@ -779,7 +779,7 @@
     sqlite3 *db = [iSalesDB get_db];
     
     // order by w.create_time
-    NSString* sqlQuery = [NSString stringWithFormat:@"select w.product_id,m.name||'\n'||m.description,w._id,w.qty from wishlist as w  left join product as m on w.product_id=m.product_id  where w.is_delete is NULL %@ ",sort_str];
+    NSString* sqlQuery = [NSString stringWithFormat:@"select w.product_id,m.name||'\n'||m.description,w._id,w.qty from wishlist as w  left join product as m on w.product_id=m.product_id  where w.is_delete is NULL or w.is_delete != 1 %@ ",sort_str];
     
 //    NSString* sqlQuery = [NSString stringWithFormat:@"select m.product_id,(m.name||'\n'||m.description) as des,w._id from product as m,wishlist as w where m.product_id = w.product_id %@",sort_str];
     
@@ -1768,10 +1768,10 @@
     
     NSString *sqlQuery = nil;
     if(exactMatch )
-        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where lower(name) like'%@%%' and m.is_active = 1 order by m.name %@;",appDelegate.order_code, keyword,limit_str]; // select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%@%%' order by m.name limit %d offset %d ;
+        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where lower(name) like'%@%%' and m.is_active = 1  and (w.is_delete is NULL or w.is_delete != 1) order by m.name %@;",appDelegate.order_code, keyword,limit_str]; // select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%@%%' order by m.name limit %d offset %d ;
     else
         
-        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where (lower(name) like'%%%@%%' or lower(description) like'%%%@%%') and m.is_active = 1 order by m.name %@ ;",appDelegate.order_code, keyword,keyword,limit_str];// select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%%%@%%' or
+        sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where (lower(name) like'%%%@%%' or lower(description) like'%%%@%%') and m.is_active = 1 and (w.is_delete is NULL or w.is_delete != 1) order by m.name %@ ;",appDelegate.order_code, keyword,keyword,limit_str];// select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where lower(name) like'%%%@%%' or
     
     DebugLog(@"offline_search sql:%@",sqlQuery);
     sqlite3_stmt * statement;
@@ -2796,7 +2796,7 @@
             
             
             
-            int wish_count = [iSalesDB get_recordcount:db table:@"wishlist" where:@"1=1"];
+            int wish_count = [iSalesDB get_recordcount:db table:@"wishlist" where:@"is_delete is  NULL or is_delete != 1"];
             [header setObject:[NSString stringWithFormat:@"%d",wish_count] forKey:@"wish_count"];
             
 //            int portfolio_count = [iSalesDB get_recordcount:db table:@"portfoliolist" where:@"1=1"];
@@ -3702,7 +3702,7 @@
 //    NSString *sql = @"";
     for(int i=0;i<arr.count;i++)
     {
-        NSString* where=[NSString stringWithFormat:@"product_id=%@",arr[i]];
+        NSString* where=[NSString stringWithFormat:@"product_id=%@ and is_delete is  NULL or is_delete != 1",arr[i]];
         int count=[iSalesDB get_recordcount:db table:@"wishlist" where:where];
         if(count==0)
         {
@@ -3753,7 +3753,7 @@
 
     }
 //    [iSalesDB execSql:sql db:db];
-    int count=[iSalesDB get_recordcount:db table:@"wishlist" where:@"1=1"];
+    int count=[iSalesDB get_recordcount:db table:@"wishlist" where:@"is_delete is  NULL or is_delete != 1"];
     [iSalesDB execSql:@"END TRANSACTION" db:db];
     
     int wish_count = [iSalesDB get_recordcount:db table:@"wishlist" where:@"1=1"];
@@ -5444,7 +5444,7 @@
     NSString *where = [NSString stringWithFormat:@"category like'%%#%@#%%' and is_active = 1",category];
     
     
-    NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id  where m.category like'%%#%@#%%' and m.is_active = 1 order by m.name %@ ;",appDelegate.order_code, category,limit_str];
+    NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from product m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id  where m.category like'%%#%@#%%' and m.is_active = 1 and (w.is_delete is NULL or w.is_delete != 1) order by m.name %@ ;",appDelegate.order_code, category,limit_str];
     
     
     double price_min = 0;
@@ -5532,7 +5532,7 @@
         // where bestseller > 0 order by bestseller desc
         // sql query: alert     availability(int)   best_seller(int)    price    qty
         
-        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
+        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where w.is_delete is NULL or w.is_delete != 1 order by %@ %@;",cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
         
         
         where =[NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@ and is_active = 1",cateWhere,best_seller,alert,available_condition,qty,price];
@@ -5839,7 +5839,7 @@
         // where bestseller > 0 order by bestseller desc
         // sql query: alert     availability(int)   best_seller(int)    price    qty
         
-        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id order by %@ %@;", cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
+        sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout,c._id from (select name,description,product_id,closeout,best_seller from product where %@ %@ %@ %@ %@ %@ and is_active = 1) m left join wishlist w on m.product_id=w.product_id  left join (select _id,product_id from offline_cart where so_no='%@') c on c.product_id=m.product_id where w.is_delete is NULL or w.is_delete != 1 order by %@ %@;", cateWhere,best_seller,alert,available_condition,qty,price,appDelegate.order_code,order_best_seller,limit_str];
         
         
         // count