|
@@ -3847,7 +3847,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
for(int i=0;i<arr_id.count;i++)
|
|
for(int i=0;i<arr_id.count;i++)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- int item_qty= count;
|
|
|
|
|
|
|
+ NSInteger item_qty= count;
|
|
|
if (qty) {
|
|
if (qty) {
|
|
|
item_qty = [qty_arr[i] integerValue];
|
|
item_qty = [qty_arr[i] integerValue];
|
|
|
}
|
|
}
|
|
@@ -3888,10 +3888,10 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
sql=[NSString stringWithFormat:@"insert into offline_cart(product_id,so_no,item_count,item_id,create_time) values(?,?,?,?,datetime('now', 'localtime'))"];
|
|
sql=[NSString stringWithFormat:@"insert into offline_cart(product_id,so_no,item_count,item_id,create_time) values(?,?,?,?,datetime('now', 'localtime'))"];
|
|
|
|
|
|
|
|
sqlite3_prepare_v2(db, [sql UTF8String], -1, &stmt, nil);
|
|
sqlite3_prepare_v2(db, [sql UTF8String], -1, &stmt, nil);
|
|
|
- sqlite3_bind_text(stmt,1,[arr_id[i] UTF8String],[arr_id[i] length],NULL);
|
|
|
|
|
- sqlite3_bind_text(stmt,2,[orderCode UTF8String],[orderCode length],NULL);
|
|
|
|
|
- sqlite3_bind_text(stmt,3,[[NSString stringWithFormat:@"%d",item_qty] UTF8String],[[NSString stringWithFormat:@"%d",item_qty] length],NULL);
|
|
|
|
|
- sqlite3_bind_text(stmt,4,[[NSString stringWithFormat:@"%d",item_id] UTF8String],[[NSString stringWithFormat:@"%d",item_id] length],NULL);
|
|
|
|
|
|
|
+ sqlite3_bind_text(stmt,1,[arr_id[i] UTF8String],(int)[arr_id[i] length],NULL);
|
|
|
|
|
+ sqlite3_bind_text(stmt,2,[orderCode UTF8String],(int)[orderCode length],NULL);
|
|
|
|
|
+ sqlite3_bind_text(stmt,3,[[NSString stringWithFormat:@"%ld",item_qty] UTF8String],(int)[[NSString stringWithFormat:@"%ld",item_qty] length],NULL);
|
|
|
|
|
+ sqlite3_bind_text(stmt,4,[[NSString stringWithFormat:@"%d",item_id] UTF8String],(int)[[NSString stringWithFormat:@"%d",item_id] length],NULL);
|
|
|
shouldStep = YES;
|
|
shouldStep = YES;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -3904,7 +3904,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
shouldStep = YES;
|
|
shouldStep = YES;
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
|
- sql = [NSString stringWithFormat:@"select c.item_count + %d,p.availability from product as p left join offline_cart as c on c.item_id = p.item_id where c._id = %d;",item_qty,_id];
|
|
|
|
|
|
|
+ sql = [NSString stringWithFormat:@"select c.item_count + %ld,p.availability from product as p left join offline_cart as c on c.item_id = p.item_id where c._id = %d;",item_qty,_id];
|
|
|
__block BOOL update = YES;
|
|
__block BOOL update = YES;
|
|
|
[iSalesDB jk_query:sql db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
[iSalesDB jk_query:sql db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
|
|
@@ -3923,8 +3923,8 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
sql=[NSString stringWithFormat:@"update offline_cart set item_count=item_count+?,create_time = datetime('now', 'localtime') where _id=?"];
|
|
sql=[NSString stringWithFormat:@"update offline_cart set item_count=item_count+?,create_time = datetime('now', 'localtime') where _id=?"];
|
|
|
|
|
|
|
|
sqlite3_prepare_v2(db, [sql UTF8String], -1, &stmt, nil);
|
|
sqlite3_prepare_v2(db, [sql UTF8String], -1, &stmt, nil);
|
|
|
- sqlite3_bind_text(stmt,1,[[NSString stringWithFormat:@"%d",item_qty] UTF8String],[[NSString stringWithFormat:@"%d",item_qty] length],NULL);
|
|
|
|
|
- sqlite3_bind_text(stmt,2,[[NSString stringWithFormat:@"%d",_id] UTF8String],[[NSString stringWithFormat:@"%d",_id] length],NULL);
|
|
|
|
|
|
|
+ sqlite3_bind_text(stmt,1,[[NSString stringWithFormat:@"%ld",item_qty] UTF8String],(int)[[NSString stringWithFormat:@"%ld",item_qty] length],NULL);
|
|
|
|
|
+ sqlite3_bind_text(stmt,2,[[NSString stringWithFormat:@"%d",_id] UTF8String],(int)[[NSString stringWithFormat:@"%d",_id] length],NULL);
|
|
|
shouldStep = YES;
|
|
shouldStep = YES;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -3959,7 +3959,8 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
ret[@"result"]=[NSNumber numberWithInt:RESULT_TRUE ];
|
|
ret[@"result"]=[NSNumber numberWithInt:RESULT_TRUE ];
|
|
|
if (number_of_outOfStock > 0) {
|
|
if (number_of_outOfStock > 0) {
|
|
|
ret[@"result"]=[NSNumber numberWithInt:8];
|
|
ret[@"result"]=[NSNumber numberWithInt:8];
|
|
|
- ret[@"err_msg"] = [NSString stringWithFormat:@"%d item is out of stock",number_of_outOfStock];
|
|
|
|
|
|
|
+ ret[@"err_msg"] = @"Out of Stock.\nNo more quantity available.\nPlease try again after sync.";
|
|
|
|
|
+ /*[NSString stringWithFormat:@"%d item is out of stock",number_of_outOfStock]*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[iSalesDB execSql:@"END TRANSACTION" db:db];
|
|
[iSalesDB execSql:@"END TRANSACTION" db:db];
|
|
@@ -3970,8 +3971,8 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
|
|
|
|
|
+(NSDictionary*) model_bundle:(int) item_id db:(sqlite3*)db compute_part:(bool)compute contactID:(NSString *)contactID
|
|
+(NSDictionary*) model_bundle:(int) item_id db:(sqlite3*)db compute_part:(bool)compute contactID:(NSString *)contactID
|
|
|
{
|
|
{
|
|
|
- UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
|
|
+// UIApplication * app = [UIApplication sharedApplication];
|
|
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc]init];
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc]init];
|
|
|
|
|
|