diff --git a/main.c b/main.c index 9cb3c15..2303d31 100644 --- a/main.c +++ b/main.c @@ -7,7 +7,7 @@ #include #include #include -#include Up +#include #include #endif #ifndef CUSTOM_H diff --git a/normal_user.h b/normal_user.h index 59f40ea..31cf318 100644 --- a/normal_user.h +++ b/normal_user.h @@ -76,7 +76,6 @@ void search_item(void * (*showitem)(void *,int)){ break; } char* searchstr = prompt_search(); - printf("searching...\n"); map = searchItems(db,searchstr); if(map[0].value > 0){ int temp_row = *((int*)map[0].value); @@ -100,10 +99,11 @@ void search_item(void * (*showitem)(void *,int)){ char* prompt_search(){ - printf("Enter search string:(largest length 100)(case insesitive)\n>"); + printf("Enter search string(largest length 100)\n(case insensitive)\nmatches multiple columns\n>"); char* searchstr = malloc(sizeof(char) * 100); fflush_stdin(); scanf("%s", searchstr); + printf("searching...\n"); return searchstr; } @@ -114,7 +114,11 @@ struct Map* searchItems(struct inventory db, char* searchstr){ int k = 1; for (int i = 0; i < db.db.row_count; i++){ map[k].key = i; - if(strcasestr(db.row[i].product,searchstr) != NULL){ + if(strcasestr(db.row[i].product,searchstr) != NULL|| + strcasestr(db.row[i].brand,searchstr) != NULL|| + strcasestr(db.row[i].category,searchstr) != NULL|| + strcasestr(lto_string(db.row[i].barcode),searchstr) != NULL + ){ map[k].value = (void*)db.row[i].product; k++; diff --git a/sba report template.docx b/sba report template.docx index a77e8ae..6553e36 100644 Binary files a/sba report template.docx and b/sba report template.docx differ diff --git a/sba report template.pdf b/sba report template.pdf index c3a1303..f91543f 100644 Binary files a/sba report template.pdf and b/sba report template.pdf differ diff --git a/utils.h b/utils.h index f89ec1f..d8ca7b2 100644 --- a/utils.h +++ b/utils.h @@ -32,6 +32,11 @@ void fflush_stdin(){ __fpurge(stdin); #endif } +char * lto_string(long num){ + char * str = malloc(sizeof(char) * 100); + sprintf(str,"%ld",num); + return str; +} char * welcome_message(void * ptr){ //cross compatible @@ -101,7 +106,7 @@ bool item_inputer(char * varname,INPUT_TYPE type,void * item,bool empty_allowed) if(temp == NULL){ return false; } - switch(type){ + switch(type){ case INT: *((int*)item) = atoi(temp); break;