sba/database.h
2022-08-27 11:39:59 +08:00

112 lines
2.1 KiB
C

//include std lib if they havent been included
#ifndef STD_LIB_H
#define STD_LIB_H
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#endif
#ifndef DNT_H
#define DNT_H
#include "dateNtime.h"
#endif // !DNT_H
typedef struct basic_db{
FILE *fp;
int row_count;
//array of struct of row
};
//inventory
typedef struct inventory{
struct basic_db db;
struct inventory_row* row;
};
typedef struct inventory_row{
char category[100];
char band[100];
char product[100];
double price;
double cost;
int stock;
long barcode;
};
typedef enum INVENTORY {
category = 1, brand = 2, product = 3, price = 4, cost = 5, stock = 6 , barcode = 7
};
//transaction
typedef struct transaction{
struct basic_db db;
struct transaction_row* row;
};
typedef struct transaction_row{
struct date date;
struct time time;
long id;
double price;
int quantity;
long barcode;
};
typedef enum TRANSACTION {
date = 1, time = 2, id = 3, price = 5, quantity = 4, barcode = 7
};
//user
typedef struct user{
struct basic_db db;
struct user_row* row;
};
typedef struct user_row{
char name[100];
char role[100];
long id;
bool isAdmin;
};
typedef enum USER {
name = 1, role = 2,id = 3
};
//list of db func
bool read_db_invt(FILE* fp,enum INVENTORY inventory){
return true;
}
bool read_db_tran(FILE* fp,enum TRANSACTION transaction){
return true;
}
bool read_db_user(FILE* fp,enum USER user){
return true;
}
bool new_db_invt(FILE* fp,enum INVENTORY inventory){
return true;
}
bool new_db_tran(FILE* fp,enum TRANSACTION transaction){
return true;
}
bool new_db_user(FILE* fp,enum USER user){
return true;
}
bool edit_db_invt(FILE* fp,enum INVENTORY inventory){
return true;
}
bool edit_db_tran(FILE* fp,enum TRANSACTION transaction){
return true;
}
bool edit_db_user(FILE* fp,enum USER user){
return true;
}
bool rm_db_invt(FILE* fp,enum INVENTORY inventory){
return true;
}
bool rm_db_tran(FILE* fp,enum TRANSACTION transaction){
return true;
}
bool rm_db_user(FILE* fp,enum USER user){
return true;
}