Modifiche e correzioni generali ai assisted
This commit is contained in:
1 parent
05237cc7f1
commit
c6543cc583
13 files changed
+1645
-321
No files matched your search
@@ -7,5 +7,6 @@
|
||||
|
||||
extern char productPricesFileLocation[64]; // Dichiarazione extern
|
||||
extern char countFileLocation[64];
|
||||
extern char configFileLocation[64];
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef JSONFILE_H
|
||||
#define JSONFILE_H
|
||||
|
||||
#include <json-c/json.h>
|
||||
|
||||
int existsFile(const char *fname);
|
||||
int createFile(const char *fname);
|
||||
int renameDataFile(const char *oldName, const char *newName);
|
||||
|
||||
json_object *loadJsonArray(const char *fname);
|
||||
int saveJsonArray(const char *fname, json_object *arr);
|
||||
|
||||
json_object *findItemByName(json_object *arr, const char *name);
|
||||
int removeItemByName(json_object *arr, const char *name);
|
||||
int renameItemByName(json_object *arr, const char *oldName, const char *newName);
|
||||
|
||||
#endif
|
||||
+18
-6
@@ -6,7 +6,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ncurses.h>
|
||||
#include <json-c/json.h>
|
||||
#include "jsonFile.h"
|
||||
|
||||
#define PRODUCT_STOCK_UNLIMITED (-1)
|
||||
|
||||
struct product {
|
||||
float cost;
|
||||
@@ -14,23 +16,33 @@ struct product {
|
||||
char name;
|
||||
};
|
||||
|
||||
/* File */
|
||||
int existsFile(const char *fname);
|
||||
int createFile(const char *fname);
|
||||
int renameDataFile(const char *oldName, const char *newName);
|
||||
|
||||
/* Prodotti */
|
||||
json_object *getProducts(const char *fname);
|
||||
void listProducts(const char *fname);
|
||||
int addProduct(const char *fname, const char *name, double price);
|
||||
int addProductWithInventory(const char *fname, const char *name, double price, int stock);
|
||||
int addBundleProduct(const char *fname, const char *name, double price, json_object *components);
|
||||
double getPrice(const char *fname, const char *name);
|
||||
int updateProduct(const char *productsFile, const char *soldFile, const char *oldName, const char *newName, double price);
|
||||
int updateProductWithInventory(const char *productsFile, const char *soldFile, const char *oldName, const char *newName, double price, int stock);
|
||||
int getProductInventory(const char *fname, const char *name, int *stock, int *tracked);
|
||||
int setProductInventory(const char *fname, const char *name, int stock, int tracked);
|
||||
int consumeProductInventory(const char *fname, const char *name, int qty);
|
||||
|
||||
/* Copie vendute */
|
||||
int getCount(const char *fname, const char *name);
|
||||
void listSold(const char *fname);
|
||||
int addSold(const char *fname, const char *name, int qty);
|
||||
int updateSold(const char *fname, const char *name, int qty);
|
||||
int deleteSold(const char *fname, const char *name);
|
||||
int recordSale(const char *productsFile, const char *soldFile, const char *name, int qty);
|
||||
|
||||
/* Entrate */
|
||||
double getTotalRevenue(const char *productsFile, const char *soldFile);
|
||||
|
||||
/* Config */
|
||||
int ensureAppConfig(const char *fname);
|
||||
int loadAppConfig(const char *fname);
|
||||
int saveAppConfig(const char *fname);
|
||||
|
||||
#endif
|
||||
@@ -9,6 +9,7 @@
|
||||
int runMainMenu();
|
||||
void runOptionsMenu();
|
||||
void runSellWindow();
|
||||
void runCreateBundleWindow();
|
||||
void runAboutWindow();
|
||||
void runViewSalesWindow();
|
||||
void runViewProductsWindow();
|
||||
|
||||
Reference in new issue
Block a user