|
|
@@ -1478,7 +1478,7 @@
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc]init];
|
|
|
|
|
|
|
|
|
- NSString *sqlQuery = [NSString stringWithFormat:@"select item_id,qty,name,description,unit_price from bundle where product_item_id=%d;",item_id];
|
|
|
+ NSString *sqlQuery = [NSString stringWithFormat:@"select b.item_id,b.qty,c.name,c.description,b.unit_price,b.use_unitprice from (select item_id,qty,decrypt(unit_price) as unit_price,use_unitprice from bundle where product_item_id=%d) b left join catalog c on b.item_id=c.item_id;",item_id];
|
|
|
sqlite3_stmt * statement;
|
|
|
|
|
|
int count=0;
|
|
|
@@ -1503,6 +1503,11 @@
|
|
|
NSString* nsdescription=[[NSString alloc]initWithUTF8String:description];
|
|
|
|
|
|
double unit_price = sqlite3_column_double(statement, 4);
|
|
|
+ int use_unitprice = sqlite3_column_int(statement, 5);
|
|
|
+ if(use_unitprice!=1)
|
|
|
+ {
|
|
|
+ unit_price=0;
|
|
|
+ }
|
|
|
|
|
|
itemjson[@"model"]=nsname;
|
|
|
itemjson[@"description"]=nsdescription;
|
|
|
@@ -1518,7 +1523,10 @@
|
|
|
sqlite3_finalize(statement);
|
|
|
}
|
|
|
}
|
|
|
- return ret;
|
|
|
+ if(count==0)
|
|
|
+ return nil;
|
|
|
+ else
|
|
|
+ return ret;
|
|
|
}
|
|
|
+(NSDictionary*) model_subtotal:(int) item_id count:(int)count db:(sqlite3*)db compute_part:(bool)compute
|
|
|
{
|
|
|
@@ -1530,7 +1538,7 @@
|
|
|
int carton=0;
|
|
|
|
|
|
|
|
|
- NSString *sqlQuery = [NSString stringWithFormat:@"select ulength ,uwidth ,uheight ,uweight ,mlength ,mwidth ,mheight ,mweigth ,ilength ,iwidth ,iheight , iweight ,pcs ,mpack ,ipack from catalog where item_id=%d;",item_id];
|
|
|
+ NSString *sqlQuery = [NSString stringWithFormat:@"select ulength ,uwidth ,uheight ,uweight ,mlength ,mwidth ,mheight ,mweigth ,ilength ,iwidth ,iheight , iweight ,pcs ,mpack ,ipack,ucbf,icbf,mcbf from catalog where item_id=%d;",item_id];
|
|
|
sqlite3_stmt * statement;
|
|
|
|
|
|
|
|
|
@@ -1554,6 +1562,9 @@
|
|
|
int pcs = sqlite3_column_int(statement,12);
|
|
|
int mpack = sqlite3_column_int(statement, 13);
|
|
|
int ipack = sqlite3_column_int(statement, 14);
|
|
|
+ double ucbf = sqlite3_column_double(statement, 15);
|
|
|
+ double icbf = sqlite3_column_double(statement, 16);
|
|
|
+ double mcbf = sqlite3_column_double(statement, 17);
|
|
|
|
|
|
if(ipack==0)
|
|
|
{
|
|
|
@@ -1606,7 +1617,10 @@
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+#ifdef BUILD_NPD
|
|
|
+ cuft=ucbf*count;
|
|
|
+ weight= uweight*count;
|
|
|
+#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1614,6 +1628,9 @@
|
|
|
sqlite3_finalize(statement);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if(compute)
|
|
|
{
|
|
|
NSArray * arr_count=nil;
|
|
|
@@ -1646,7 +1663,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
- NSString *sqlQuery = [ NSString stringWithFormat:@"select c.product_id,c.str_price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price),discount,item_count,line_note,item_id from offline_count where so_no='%@') c left join product m on c.product_id=m.product_id",orderCode ];
|
|
|
+ NSString *sqlQuery = [ NSString stringWithFormat:@"select c.product_id,c.price,c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from (select _id,product_id,decrypt(str_price) as price,discount,item_count,line_note,item_id from offline_cart where so_no='%@') c left join product m on c.product_id=m.product_id",orderCode ];
|
|
|
+
|
|
|
+
|
|
|
+// NSString *sqlQuery = [ NSString stringWithFormat:@"select c.product_id,decrypt(c.str_price),c.discount,c.item_count,c.line_note,m.name,m.description,c.item_id,m.stockUom,c._id from offline_cart c left join product m on c.product_id=m.product_id where c.so_no='%@'",orderCode ];
|
|
|
+
|
|
|
+
|
|
|
+// NSString *sqlQuery = @"select * from (select decrypt(str_price) from offline_cart) c";
|
|
|
|
|
|
DebugLog(@"offline_login sql:%@",sqlQuery);
|
|
|
sqlite3_stmt * statement;
|
|
|
@@ -1655,7 +1678,8 @@
|
|
|
[ret setValue:[NSNumber numberWithInt:AP_USER_NOT_AUTH ] forKey:@"result"];
|
|
|
|
|
|
int count=0;
|
|
|
- if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
|
|
|
+ int dbresult=sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil);
|
|
|
+ if ( dbresult== SQLITE_OK)
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -1700,19 +1724,21 @@
|
|
|
nsline_note= [[NSString alloc]initWithUTF8String:line_note];
|
|
|
|
|
|
|
|
|
- char *name = (char*)sqlite3_column_text(statement, 6);
|
|
|
+ char *name = (char*)sqlite3_column_text(statement, 5);
|
|
|
NSString *nsname=nil;
|
|
|
if(name!=nil)
|
|
|
nsname= [[NSString alloc]initWithUTF8String:name];
|
|
|
|
|
|
- char *description = (char*)sqlite3_column_text(statement, 7);
|
|
|
+ char *description = (char*)sqlite3_column_text(statement, 6);
|
|
|
NSString *nsdescription=nil;
|
|
|
if(description!=nil)
|
|
|
nsdescription= [[NSString alloc]initWithUTF8String:description];
|
|
|
|
|
|
+
|
|
|
|
|
|
int stockUom = sqlite3_column_int(statement, 9);
|
|
|
int _id = sqlite3_column_int(statement, 10);
|
|
|
+
|
|
|
|
|
|
NSDictionary* bsubtotaljson=[self model_subtotal:item_id count:item_count db:db compute_part:true];
|
|
|
double cuft=[bsubtotaljson[@"cuft"] doubleValue];
|
|
|
@@ -1726,7 +1752,7 @@
|
|
|
itemjson[@"carton"]=[NSNumber numberWithInt:carton];
|
|
|
itemjson[@"cart_item_id"]=[NSNumber numberWithInt:_id];
|
|
|
itemjson[@"check"]=@"true";
|
|
|
- itemjson[@"product_id"]=[NSNumber numberWithInt:product_id];
|
|
|
+ itemjson[@"product_id"]=[NSNumber numberWithInt:product_id].stringValue;
|
|
|
itemjson[@"count"]=[NSNumber numberWithInt:item_count];
|
|
|
itemjson[@"unit_price"]=Price;
|
|
|
itemjson[@"discount"]=[NSNumber numberWithInt:discount];
|
|
|
@@ -1739,7 +1765,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ ret[@"result"]=[NSNumber numberWithInt:RESULT_TRUE ];
|
|
|
sqlite3_finalize(statement);
|
|
|
}
|
|
|
|
|
|
@@ -1754,7 +1780,7 @@
|
|
|
ret[@"wish_count"]=[NSNumber numberWithInt:wish_count ];
|
|
|
ret[@"cart_count"]=[NSNumber numberWithInt:cart_count ];
|
|
|
ret[@"count"]=[NSNumber numberWithInt:cart_count ];
|
|
|
- ret[@"result"]=[NSNumber numberWithInt:RESULT_TRUE ];
|
|
|
+
|
|
|
ret[@"mode"]=@"Regular Mode";
|
|
|
|
|
|
ret[@"general_note"]=@"GENERAL NOTE NOT IMPL";
|