diff --git a/Pedidos.o b/Pedidos.o deleted file mode 100644 index 3ca01f15..00000000 Binary files a/Pedidos.o and /dev/null differ diff --git a/data/icones_opc/planilha.png b/data/icones_opc/planilha.png new file mode 100644 index 00000000..127b22c2 Binary files /dev/null and b/data/icones_opc/planilha.png differ diff --git a/data/icones_opc/planilha_movimentos.png b/data/icones_opc/planilha_movimentos.png new file mode 100644 index 00000000..d9dedf32 Binary files /dev/null and b/data/icones_opc/planilha_movimentos.png differ diff --git a/data/icones_opc/planilha_prods.png b/data/icones_opc/planilha_prods.png new file mode 100644 index 00000000..ed0cee31 Binary files /dev/null and b/data/icones_opc/planilha_prods.png differ diff --git a/data/icones_opc/planilha_terceiros.png b/data/icones_opc/planilha_terceiros.png new file mode 100644 index 00000000..9159db2a Binary files /dev/null and b/data/icones_opc/planilha_terceiros.png differ diff --git a/data/icones_opc/planilhas.png b/data/icones_opc/planilhas.png new file mode 100644 index 00000000..68d22862 Binary files /dev/null and b/data/icones_opc/planilhas.png differ diff --git a/pedidos b/pedidos deleted file mode 100755 index 4ef899d9..00000000 Binary files a/pedidos and /dev/null differ diff --git a/src/Canones/gerenciador_janelas/gerenciador_janelas.c b/src/Canones/gerenciador_janelas/gerenciador_janelas.c index a909afc2..ba4abb56 100755 --- a/src/Canones/gerenciador_janelas/gerenciador_janelas.c +++ b/src/Canones/gerenciador_janelas/gerenciador_janelas.c @@ -269,10 +269,17 @@ void gerenciador_load_funcs(){ janelas_gerenciadas.vetor_janelas[REG_REL_FIX_FINPAG_WIN].fun = rel_fix_fin_pag; janelas_gerenciadas.vetor_janelas[CAD_TRSP_WND].fun = trsp_cad_fun; + //relatórios planilhas + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_ICONS_WIN].fun = planilha_icon_view_wnd; + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_PRODS_WIN].fun = planilha_init_export; //module PLANL_MOD_PRODUTOS + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_TER_WIN].fun = planilha_init_export; //module PLANL_MOD_TERCEIROS + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_MOV_WIN].fun = planilha_init_export; //module PLANL_MOD_MOVIMENTOS + //opcoes tecnicas janelas_gerenciadas.vetor_janelas[REG_CAD_EMPRESA].fun = cadastro_empresa; janelas_gerenciadas.vetor_janelas[REG_CAD_CNTRATS].fun = cad_contratos; janelas_gerenciadas.vetor_janelas[REG_TNCLOG_WND].fun = tecn_logger_wnd; janelas_gerenciadas.vetor_janelas[REG_BACKUP_WND].fun = backup_fun; + } diff --git a/src/Canones/gerenciador_janelas/gerenciador_janelas.h b/src/Canones/gerenciador_janelas/gerenciador_janelas.h index f75e0481..e876911a 100755 --- a/src/Canones/gerenciador_janelas/gerenciador_janelas.h +++ b/src/Canones/gerenciador_janelas/gerenciador_janelas.h @@ -65,6 +65,12 @@ REG_CAD_CNTRATS, REG_TNCLOG_WND, REG_BACKUP_WND, +REG_REL_PLANL_ICONS_WIN, +REG_PLANL_CONF_ICONS_WIN, +REG_REL_PLANL_TER_WIN, +REG_REL_PLANL_PRODS_WIN, +REG_REL_PLANL_MOV_WIN, + REG_WIN_QNT, }; @@ -135,7 +141,16 @@ static const char *janelas_nomes[] = { "Cadastro da Empresa", "Cadastro de Contratos", "Visualizador de Logs", - "Gerador de Backups" + "Gerador de Backups", + + //planilhas + "Relatório de Planilhas", + "Gerador de Planilhas", + "Planilha de Clientes", + "Planilha de Produtos", + "Planilha de Movimentos", + + }; typedef struct _janelas_info{ diff --git a/src/Menu/cad_ico.c b/src/Menu/cad_ico.c index dde5481a..498020d8 100755 --- a/src/Menu/cad_ico.c +++ b/src/Menu/cad_ico.c @@ -76,7 +76,7 @@ GtkWidget *cad_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/cmp_ico.c b/src/Menu/cmp_ico.c index ebea9c3d..bd88f82e 100755 --- a/src/Menu/cmp_ico.c +++ b/src/Menu/cmp_ico.c @@ -42,7 +42,7 @@ GtkWidget *cmp_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/est_ico.c b/src/Menu/est_ico.c index 7e664a9e..ac03b67b 100755 --- a/src/Menu/est_ico.c +++ b/src/Menu/est_ico.c @@ -42,7 +42,7 @@ GtkWidget *est_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/fin_ico.c b/src/Menu/fin_ico.c index 321dc7df..9fe1744c 100644 --- a/src/Menu/fin_ico.c +++ b/src/Menu/fin_ico.c @@ -63,7 +63,7 @@ GtkWidget *fin_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/iconview.c b/src/Menu/iconview.c index 8a5fad32..c41fad02 100644 --- a/src/Menu/iconview.c +++ b/src/Menu/iconview.c @@ -7,16 +7,6 @@ #include "rel_ico.c" #include "tcn_ico.c" -void menu_icon_view_select(GtkIconView *icon_view, GtkTreePath *path, gpointer data){ - - if(menu_notebook && GTK_IS_WIDGET(menu_notebook)) - menu_notebook_atual_pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(menu_notebook)); - if(data && GTK_IS_WIDGET(data)){ - gtk_widget_destroy(data); - } - -} - gboolean desfocar_menu(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data){ if((event->mode == GDK_CROSSING_UNGRAB) || (event->mode == GDK_CROSSING_GTK_UNGRAB) ){ diff --git a/src/Menu/iconview.h b/src/Menu/iconview.h index f43a8c18..5c933783 100644 --- a/src/Menu/iconview.h +++ b/src/Menu/iconview.h @@ -3,8 +3,6 @@ int menu_icon_views_wnd(); -void menu_icon_view_select(GtkIconView *icon_view, GtkTreePath *path, gpointer data); - GtkWidget *menu_notebook; static int menu_notebook_atual_pos=0; diff --git a/src/Menu/mkt_ico.c b/src/Menu/mkt_ico.c index e464a6d2..7ccd80fe 100644 --- a/src/Menu/mkt_ico.c +++ b/src/Menu/mkt_ico.c @@ -42,7 +42,7 @@ GtkWidget *mkt_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/rel_ico.c b/src/Menu/rel_ico.c index 92113758..58151ce1 100755 --- a/src/Menu/rel_ico.c +++ b/src/Menu/rel_ico.c @@ -40,6 +40,13 @@ GtkWidget *rel_menu_get_icon_view(){ 1,gtk_image_get_pixbuf(GTK_IMAGE(gtk_image_new_from_file(REL_ORC_PROD_IMG))), 2,REG_REL_FIX_ICONS_WIN,-1); + gtk_tree_store_append(modelo,&iter,NULL); + gtk_tree_store_set(modelo, + &iter, + 0,janelas_nomes[REG_REL_PLANL_ICONS_WIN], + 1,gtk_image_get_pixbuf(GTK_IMAGE(gtk_image_new_from_file(REL_PLANL_IMG))), + 2,REG_REL_PLANL_ICONS_WIN,-1); + gtk_icon_view_set_model(GTK_ICON_VIEW(icon_view),GTK_TREE_MODEL(modelo)); @@ -50,7 +57,7 @@ GtkWidget *rel_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/tcn_ico.c b/src/Menu/tcn_ico.c index 5ff4eb19..aad6f95c 100644 --- a/src/Menu/tcn_ico.c +++ b/src/Menu/tcn_ico.c @@ -44,7 +44,7 @@ GtkWidget *tcn_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Menu/vnd_ico.c b/src/Menu/vnd_ico.c index 5d6a6276..2fad9e7f 100755 --- a/src/Menu/vnd_ico.c +++ b/src/Menu/vnd_ico.c @@ -42,7 +42,7 @@ GtkWidget *vnd_menu_get_icon_view(){ gtk_icon_view_set_margin(GTK_ICON_VIEW(icon_view),10); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(icon_view,"item-activated",G_CALLBACK(menu_icon_view_select), janelas_gerenciadas.vetor_janelas[REG_MENU_WND].janela_pointer); return icon_view; diff --git a/src/Relatorios/fixados/estoques/gerar.c b/src/Relatorios/fixados/estoques/gerar.c index 043f16d4..47fe6777 100644 --- a/src/Relatorios/fixados/estoques/gerar.c +++ b/src/Relatorios/fixados/estoques/gerar.c @@ -14,7 +14,7 @@ int relat_fix_est_gerar_fun(){ GDir *dir; if(!(dir = g_dir_open(REL_FIX_MOV_PATH,0,NULL))){ popup(NULL,"Diretorio sendo criado"); - if(g_mkdir_with_parents(REL_FIX_MOV_PATH, 777)){ + if(g_mkdir_with_parents(REL_FIX_FIN_PATH, 777) == -1){ popup(NULL,"Não foi possível criar diretorio de relatorios"); return 1; } diff --git a/src/Relatorios/fixados/financeiro/pagar/gerar.c b/src/Relatorios/fixados/financeiro/pagar/gerar.c index c7da61b8..83917cd9 100644 --- a/src/Relatorios/fixados/financeiro/pagar/gerar.c +++ b/src/Relatorios/fixados/financeiro/pagar/gerar.c @@ -17,7 +17,7 @@ int rel_fix_fin_pag_gerar(){ GDir *teste; if(!(teste = g_dir_open(REL_FIX_FIN_PATH,0,NULL))){ - if(g_mkdir_with_parents(REL_FIX_FIN_PATH, 777)){ + if(g_mkdir_with_parents(REL_FIX_FIN_PATH, 777) == -1){ popup(NULL,"Não foi possível abrir/criar diretório do arquivo"); return 1; } diff --git a/src/Relatorios/fixados/financeiro/receber/gerar.c b/src/Relatorios/fixados/financeiro/receber/gerar.c index c9863d2f..5d063a7f 100644 --- a/src/Relatorios/fixados/financeiro/receber/gerar.c +++ b/src/Relatorios/fixados/financeiro/receber/gerar.c @@ -17,7 +17,7 @@ int rel_fix_fin_rec_gerar(){ GDir *teste; if(!(teste = g_dir_open(REL_FIX_FIN_PATH,0,NULL))){ - if(g_mkdir_with_parents(REL_FIX_FIN_PATH, 777)){ + if(g_mkdir_with_parents(REL_FIX_FIN_PATH, 777) == -1){ popup(NULL,"Não foi possível abrir/criar diretório do arquivo"); return 1; } diff --git a/src/Relatorios/fixados/iconview.c b/src/Relatorios/fixados/iconview.c index 45a81f8c..bdfdb079 100644 --- a/src/Relatorios/fixados/iconview.c +++ b/src/Relatorios/fixados/iconview.c @@ -46,13 +46,14 @@ int relat_icon_view_wnd(){ gtk_icon_view_set_model(GTK_ICON_VIEW(icon_view),GTK_TREE_MODEL(modelo)); //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); - g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select), modelo); + gtk_icon_view_set_columns (GTK_ICON_VIEW(icon_view),2); gtk_icon_view_set_text_column(GTK_ICON_VIEW(icon_view),0); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(icon_view),1); gtk_container_add(GTK_CONTAINER(fixed_relats_wnd),icon_view); + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller), modelo); g_signal_connect(fixed_relats_wnd,"destroy",G_CALLBACK(ger_janela_fechada),&janelas_gerenciadas.vetor_janelas[REG_REL_FIX_ICONS_WIN]); diff --git a/src/Relatorios/fixados/produtos/principal.c b/src/Relatorios/fixados/produtos/principal.c index b04fbc1b..5fcb7f68 100644 --- a/src/Relatorios/fixados/produtos/principal.c +++ b/src/Relatorios/fixados/produtos/principal.c @@ -53,7 +53,6 @@ int relat_fix_prod(){ GTK_WINDOW(janelas_gerenciadas.vetor_janelas[REG_REL_FIX_ICONS_WIN].janela_pointer)); gtk_container_set_border_width (GTK_CONTAINER (janela), 10); - g_signal_connect(GTK_WINDOW(janela),"delete-event",G_CALLBACK(gtk_widget_destroy),&janela); relat_fix_prod_ordem_combo = gtk_combo_box_text_new(); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(relat_fix_prod_ordem_combo),"Código"); diff --git a/src/Relatorios/fixados/terceiros/principal.c b/src/Relatorios/fixados/terceiros/principal.c index 0d05654d..4a873434 100644 --- a/src/Relatorios/fixados/terceiros/principal.c +++ b/src/Relatorios/fixados/terceiros/principal.c @@ -12,11 +12,9 @@ int relat_fix_prod(){ gtk_window_set_resizable(GTK_WINDOW(janela),FALSE); gtk_window_set_title(GTK_WINDOW(janela),"Relatório Fixo de Produtos"); gtk_window_set_icon_name(GTK_WINDOW(janela),"system-software-install"); + gtk_window_set_transient_for(GTK_WINDOW(janela),GTK_WINDOW(janela_principal)); - if(personalizacao.janela_keep_above==1) - gtk_window_set_keep_above(GTK_WINDOW(janela), TRUE); gtk_container_set_border_width (GTK_CONTAINER (janela), 10); - g_signal_connect(GTK_WINDOW(janela),"delete-event",G_CALLBACK(gtk_widget_destroy),&janela); gtk_widget_set_size_request(janela,800,500); g_signal_connect(janela,"destroy",G_CALLBACK(ger_janela_fechada),&janelas_gerenciadas.vetor_janelas[REG_REL_FIX_PROD_WIN]); diff --git a/src/Relatorios/fixados/vendas/gerar.c b/src/Relatorios/fixados/vendas/gerar.c index 0fc08a94..7c077667 100644 --- a/src/Relatorios/fixados/vendas/gerar.c +++ b/src/Relatorios/fixados/vendas/gerar.c @@ -17,7 +17,7 @@ int relat_fix_vnd_gerar_fun(){ GDir *dir; if(!(dir = g_dir_open(REL_FIX_VND_PATH,0,NULL))){ popup(NULL,"Diretorio sendo criado"); - if(g_mkdir_with_parents(REL_FIX_VND_PATH, 777)){ + if(g_mkdir_with_parents(REL_FIX_FIN_PATH, 777) == -1){ popup(NULL,"Não foi possível criar diretorio de relatorios"); return 1; } diff --git a/src/Relatorios/planilhas/gerar.c b/src/Relatorios/planilhas/gerar.c new file mode 100644 index 00000000..d61c3709 --- /dev/null +++ b/src/Relatorios/planilhas/gerar.c @@ -0,0 +1,54 @@ +int planilhas_gerar(){ + gint module = gtk_combo_box_get_active(GTK_COMBO_BOX(planilha_export_module_combo)); + const gchar *dirname = gtk_entry_get_text(GTK_ENTRY(planilha_export_path_entry)); + MYSQL_RES *res; + MYSQL_ROW row; + char query[MAX_QUERY_LEN]; + char filename[strlen(dirname) + 12]; + srand(time(NULL)); + int r = rand(); + int planilha_gerada=0; + sprintf(filename, "%s/%i.csv", dirname, r); + + FILE *pathcache = fopen(EXP_PTH_CACHE, "w"); + if(pathcache){ + fprintf(pathcache,"%s",dirname); + fclose(pathcache); + }else{ + file_logger("Nâo foi possível salvar caminho no cache"); + file_logger(strerror(errno)); + } + for(int cont=0;contmessage); + } + + return 0; +} \ No newline at end of file diff --git a/src/Relatorios/planilhas/gerar.h b/src/Relatorios/planilhas/gerar.h new file mode 100644 index 00000000..c8c1c2a6 --- /dev/null +++ b/src/Relatorios/planilhas/gerar.h @@ -0,0 +1,8 @@ +int planilhas_gerar(); + +const char *planilhas_gerar_querys[][2] = { + {ENUM_TO_STR(PLANL_MOD_TERCEIROS), "SELECT * FROM terceiros"}, + {ENUM_TO_STR(PLANL_MOD_PRODUTOS), "SELECT * FROM produtos"}, + {ENUM_TO_STR(PLANL_MOD_MOVIMENTOS), "SELECT * FROM movimento_estoque"}, + {NULL, NULL} +}; \ No newline at end of file diff --git a/src/Relatorios/planilhas/iconview.c b/src/Relatorios/planilhas/iconview.c new file mode 100644 index 00000000..b7f89b7c --- /dev/null +++ b/src/Relatorios/planilhas/iconview.c @@ -0,0 +1,64 @@ +int planilha_icon_view_wnd(){ + + int N_COLUMNS=4; + planilha_relats_wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget *search_entry = gtk_search_entry_new() ; + GtkTreeIter iter; + GtkTreeStore *modelo = gtk_tree_store_new(N_COLUMNS,G_TYPE_STRING,GDK_TYPE_PIXBUF,G_TYPE_INT, G_TYPE_INT); + GtkWidget *icon_view = gtk_icon_view_new(); + + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_ICONS_WIN].reg_id = REG_REL_PLANL_ICONS_WIN; + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_ICONS_WIN].aberta = 1; + if(ger_janela_aberta(planilha_relats_wnd, &janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_ICONS_WIN])) + return 1; + janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_ICONS_WIN].janela_pointer = planilha_relats_wnd; + + gtk_widget_set_name(planilha_relats_wnd,"relat-fixos"); + gtk_window_set_position(GTK_WINDOW(planilha_relats_wnd),3); + gtk_window_set_resizable(GTK_WINDOW(planilha_relats_wnd),FALSE); + gtk_window_set_title(GTK_WINDOW(planilha_relats_wnd),"Relatórios Planilhas"); + gtk_window_set_icon_name(GTK_WINDOW(planilha_relats_wnd),"text-x-generic"); + gtk_window_set_transient_for(GTK_WINDOW(planilha_relats_wnd),GTK_WINDOW(janela_principal)); + + gtk_tree_store_append(modelo,&iter,NULL); + gtk_tree_store_set(modelo, + &iter, + 0,janelas_nomes[REG_REL_PLANL_TER_WIN], + 1,gtk_image_get_pixbuf(GTK_IMAGE(gtk_image_new_from_file(REL_PLANL_TER_IMG))), + 2,REG_REL_PLANL_TER_WIN, + 3,PLANL_MOD_TERCEIROS, + -1); + + gtk_tree_store_append(modelo,&iter,NULL); + gtk_tree_store_set(modelo, + &iter, + 0,janelas_nomes[REG_REL_PLANL_PRODS_WIN], + 1,gtk_image_get_pixbuf(GTK_IMAGE(gtk_image_new_from_file(REL_PLANL_PROD_IMG))), + 2,REG_REL_PLANL_PRODS_WIN, + 3,PLANL_MOD_PRODUTOS, + -1); + + gtk_tree_store_append(modelo,&iter,NULL); + gtk_tree_store_set(modelo, + &iter, + 0,janelas_nomes[REG_REL_PLANL_MOV_WIN], + 1,gtk_image_get_pixbuf(GTK_IMAGE(gtk_image_new_from_file(REL_PLANL_MOV_IMG))), + 2,REG_REL_PLANL_MOV_WIN, + 3,PLANL_MOD_MOVIMENTOS, + -1); + + gtk_icon_view_set_model(GTK_ICON_VIEW(icon_view),GTK_TREE_MODEL(modelo)); + //gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(icon_view),TRUE); + + gtk_icon_view_set_columns (GTK_ICON_VIEW(icon_view),3); + gtk_icon_view_set_text_column(GTK_ICON_VIEW(icon_view),0); + gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(icon_view),1); + + gtk_container_add(GTK_CONTAINER(planilha_relats_wnd),icon_view); + + g_signal_connect(icon_view,"item-activated",G_CALLBACK(icon_view_select_caller_with_intarg), modelo); + g_signal_connect(planilha_relats_wnd,"destroy",G_CALLBACK(ger_janela_fechada),&janelas_gerenciadas.vetor_janelas[REG_REL_PLANL_ICONS_WIN]); + + gtk_widget_show_all(planilha_relats_wnd); + return 0; +} diff --git a/src/Relatorios/planilhas/iconview.h b/src/Relatorios/planilhas/iconview.h new file mode 100644 index 00000000..3deccb33 --- /dev/null +++ b/src/Relatorios/planilhas/iconview.h @@ -0,0 +1,2 @@ +static GtkWidget *planilha_relats_wnd; +int planilha_icon_view_wnd(); \ No newline at end of file diff --git a/src/Relatorios/planilhas/init_export.c b/src/Relatorios/planilhas/init_export.c new file mode 100644 index 00000000..65b3bcc7 --- /dev/null +++ b/src/Relatorios/planilhas/init_export.c @@ -0,0 +1,71 @@ +int planilha_init_export(int module){ + GtkWidget *box, *fixed, *frame; + GtkWidget *planilha_export_button; + + planilha_export_conf_wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name(planilha_relats_wnd,"relat-fixos"); + gtk_widget_set_size_request(planilha_export_conf_wnd, 500, 300); + + gtk_window_set_position(GTK_WINDOW(planilha_export_conf_wnd),3); + gtk_window_set_resizable(GTK_WINDOW(planilha_export_conf_wnd),FALSE); + gtk_window_set_title(GTK_WINDOW(planilha_export_conf_wnd),"Gerando Planilha"); + gtk_window_set_icon_name(GTK_WINDOW(planilha_export_conf_wnd),"text-x-generic"); + gtk_window_set_transient_for(GTK_WINDOW(planilha_export_conf_wnd),GTK_WINDOW(janela_principal)); + + janelas_gerenciadas.vetor_janelas[REG_PLANL_CONF_ICONS_WIN].reg_id = REG_PLANL_CONF_ICONS_WIN; + janelas_gerenciadas.vetor_janelas[REG_PLANL_CONF_ICONS_WIN].aberta = 1; + if(ger_janela_aberta(planilha_export_conf_wnd, &janelas_gerenciadas.vetor_janelas[REG_PLANL_CONF_ICONS_WIN])) + return 1; + janelas_gerenciadas.vetor_janelas[REG_PLANL_CONF_ICONS_WIN].janela_pointer = planilha_export_conf_wnd; + + GtkWidget *planilha_export_module_box = gtk_box_new(0,0); + GtkWidget *planilha_export_module_frame = gtk_frame_new("Módulo a gerar:"); + planilha_export_module_combo = gtk_combo_box_text_new(); + + gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(planilha_export_module_combo), PLANL_MOD_TERCEIROS, "Cadastros de Terceiros" ); + gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(planilha_export_module_combo), PLANL_MOD_PRODUTOS, "Cadastros de Produtos" ); + gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(planilha_export_module_combo), PLANL_MOD_MOVIMENTOS, "Movimentos de Estoque" ); + gtk_combo_box_set_active(GTK_COMBO_BOX(planilha_export_module_combo), module); + gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(planilha_export_module_combo), GTK_SENSITIVITY_OFF); + + planilha_export_open_check = gtk_check_button_new_with_label("Abrir relatório após geração?"); + + GtkWidget *planilha_export_path_box = gtk_box_new(0,0); + GtkWidget *planilha_export_path_frame = gtk_frame_new("Caminho para exportação:"); + planilha_export_path_entry = gtk_entry_new(); + planilha_export_path_button = gtk_file_chooser_button_new("Caminho para exportação", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); + gtk_box_pack_start(GTK_BOX(planilha_export_path_box), planilha_export_path_entry, 0,0,5); + gtk_box_pack_start(GTK_BOX(planilha_export_path_box), planilha_export_path_button, 0,0,5); + gtk_container_add(GTK_CONTAINER(planilha_export_path_frame), planilha_export_path_box); + + GtkWidget *planilha_export_box = gtk_box_new(0,0); + planilha_export_button = gtk_button_new_with_label("Gerar Planilha"); + gtk_button_set_image(GTK_BUTTON(planilha_export_button), gtk_image_new_from_file(IMG_OK)); + gtk_box_pack_start(GTK_BOX(planilha_export_box), planilha_export_button, 0,0,5); + + box = gtk_box_new(1,0); + frame = gtk_frame_new("Gerar backup"); + gtk_box_pack_start(GTK_BOX(box), planilha_export_module_combo, 0,0,5); + gtk_box_pack_start(GTK_BOX(box), planilha_export_path_frame, 0,0,5); + gtk_box_pack_start(GTK_BOX(box), planilha_export_open_check, 0,0,5); + gtk_box_pack_start(GTK_BOX(box), planilha_export_box, 0,0,5); + + + gtk_container_add(GTK_CONTAINER(frame), box); + gtk_container_add(GTK_CONTAINER(planilha_export_conf_wnd), frame); + + FILE *pathcache = fopen(EXP_PTH_CACHE, "r"); + if(pathcache){ + char path[MAX_PATH_LEN]; + fgets(path,MAX_PATH_LEN,pathcache); + gtk_entry_set_text(GTK_ENTRY(planilha_export_path_entry), path); + fclose(pathcache); + } + + g_signal_connect(planilha_export_path_button,"file-set",G_CALLBACK(get_filename_to_entry),planilha_export_path_entry); + g_signal_connect(planilha_export_conf_wnd,"destroy",G_CALLBACK(ger_janela_fechada),&janelas_gerenciadas.vetor_janelas[REG_PLANL_CONF_ICONS_WIN]); + g_signal_connect(planilha_export_button,"clicked",G_CALLBACK(planilhas_gerar),NULL); + + gtk_widget_show_all(planilha_export_conf_wnd); + return 0; +} \ No newline at end of file diff --git a/src/Relatorios/planilhas/init_export.h b/src/Relatorios/planilhas/init_export.h new file mode 100644 index 00000000..cbb1bdec --- /dev/null +++ b/src/Relatorios/planilhas/init_export.h @@ -0,0 +1,14 @@ +GtkWidget *planilha_export_conf_wnd; +int planilha_init_export(int module); + + +#define PLANL_MOD_TERCEIROS 0 +#define PLANL_MOD_PRODUTOS 1 +#define PLANL_MOD_MOVIMENTOS 2 +#define PLANL_MOD_QNT 3 + +GtkWidget +*planilha_export_module_combo, +*planilha_export_open_check, +*planilha_export_path_entry, +*planilha_export_path_button; \ No newline at end of file diff --git a/src/Tecnico/Backup/Backup.c b/src/Tecnico/Backup/Backup.c index c521a724..5fa93eb9 100644 --- a/src/Tecnico/Backup/Backup.c +++ b/src/Tecnico/Backup/Backup.c @@ -74,7 +74,7 @@ int backup_fun(){ g_signal_connect(init_buttom,"clicked",G_CALLBACK(backup_iniciar_exportacao),NULL); g_signal_connect(backup_file_chooser_button,"file-set",G_CALLBACK(get_filename_to_entry),backup_file_chooser_entry); - FILE *pathcache = fopen(BACKUP_PATH_FILE, "r"); + FILE *pathcache = fopen(BKP_PTH_CACHE, "r"); if(pathcache){ char path[MAX_PATH_LEN]; fgets(path,MAX_PATH_LEN,pathcache); diff --git a/src/Tecnico/Backup/init_backup.c b/src/Tecnico/Backup/init_backup.c index 7c7d558d..8c88512d 100644 --- a/src/Tecnico/Backup/init_backup.c +++ b/src/Tecnico/Backup/init_backup.c @@ -5,7 +5,7 @@ int backup_iniciar_exportacao(){ popup(NULL,"Insira o caminho para o Backup"); return 1; } - FILE *pathcache = fopen(BACKUP_PATH_FILE, "w"); + FILE *pathcache = fopen(BKP_PTH_CACHE, "w"); if(pathcache){ fprintf(pathcache,"%s",dir_filename); fclose(pathcache); diff --git a/src/etc/check_dirs.c b/src/etc/check_dirs.c new file mode 100644 index 00000000..e211c9b6 --- /dev/null +++ b/src/etc/check_dirs.c @@ -0,0 +1,14 @@ +int check_directorys(){ + for(int cont=0; check_directorys_list[cont] != NULL; cont++){ + GDir *directory; + if(!(directory = g_dir_open(check_directorys_list[cont],0,NULL))){ + if( g_mkdir_with_parents(check_directorys_list[cont], 777 ) == -1){ + popup(NULL, "Não foi possível validar diretórios necessários para o funcionamento"); + file_logger("Erro ao criar diretório"); + file_logger((gchar*)check_directorys_list[cont]); + return 1; + } + } + } + return 0; +} \ No newline at end of file diff --git a/src/etc/check_dirs.h b/src/etc/check_dirs.h new file mode 100644 index 00000000..f1fcdba7 --- /dev/null +++ b/src/etc/check_dirs.h @@ -0,0 +1,12 @@ +int check_directorys(); + +const char *check_directorys_list[] = { + APP_DIRNAME "/files", + APP_DIRNAME "/files/impressao/", + APP_DIRNAME "/files/opcoes_padrao/", + APP_DIRNAME "/files/desktop/", + APP_DIRNAME "/files/icones_opc/", + APP_DIRNAME "/files/impressao/", + APP_DIRNAME "/files/cache/", + NULL +}; \ No newline at end of file diff --git a/src/etc/defines.h b/src/etc/defines.h index 4e0b6593..a088002b 100644 --- a/src/etc/defines.h +++ b/src/etc/defines.h @@ -32,7 +32,9 @@ #endif -#define BACKUP_PATH_FILE APP_DIRNAME "/files/backup_path" +#define BKP_PTH_CACHE APP_DIRNAME "/files/cache/backup_path" +#define EXP_PTH_CACHE APP_DIRNAME "/files/cache/backup_path" + #define APP_TRACELOG APP_DIRNAME "/files/trace_log.log" #define LOADING_GIF APP_DIRNAME "/files/gen_imgs/carregando.gif" #define SERVER_CONF APP_DIRNAME "/files/server.xml" @@ -125,12 +127,16 @@ #define TRSP_IMG APP_DIRNAME "/files/icones_opc/transportes.png" #define CAD_CEP_IMG APP_DIRNAME "/files/icones_opc/search_cep.png" #define CAD_LOGS_IMG APP_DIRNAME "/files/icones_opc/logs.png" +#define REL_PLANL_IMG APP_DIRNAME "/files/icones_opc/planilhas.png" #define REL_PROD_IMG APP_DIRNAME "/files/icones_opc/relatorio_prod.png" +#define REL_PLANL_PROD_IMG APP_DIRNAME "/files/icones_opc/planilha_prods.png" #define REL_FIX_PROD_IMG APP_DIRNAME "/files/icones_opc/relatorio_fixos_produtos.png" #define REL_FIX_TER_IMG APP_DIRNAME "/files/icones_opc/relatorio_fixos_terceiros.png" #define REL_FIX_VND_IMG APP_DIRNAME "/files/icones_opc/relatorio_fixos_vendas.png" #define REL_FIX_EST_IMG APP_DIRNAME "/files/icones_opc/relatorio_fixos_movestoque.png" +#define REL_PLANL_MOV_IMG APP_DIRNAME "/files/icones_opc/planilha_movimentos.png" #define REL_TER_IMG APP_DIRNAME "/files/icones_opc/relatorio_ter.png" +#define REL_PLANL_TER_IMG APP_DIRNAME "/files/icones_opc/planilha_terceiros.png" #define REL_SLD_IMG APP_DIRNAME "/files/icones_opc/relatorio_est.png" #define REL_ORC_PROD_IMG APP_DIRNAME "/files/icones_opc/relatorio_orc_prod.png" #define REL_FIX_VND_PATH APP_DIRNAME "/files/impressao/relatorios/fixos/vendas" @@ -146,6 +152,7 @@ #define IMPRT_TIT_IMG APP_DIRNAME "/files/icones_opc/import_tits.png" #define EXIT_IMG APP_DIRNAME "/files/icones_opc/sair.png" #define CUPONS_XMLS_DIR APP_DIRNAME "/files/xmls/cupom/" +#define CACHE_DIR APP_DIRNAME "/files/cache/" #define TMPFILE_PATH APP_DIRNAME "/files/tmp/tempfile.tmp" #define IMG_ENVIA APP_DIRNAME "/files/opcoes_padrao/enviar.png" diff --git a/src/etc/init.c b/src/etc/init.c index 460fdd08..3f7ca9df 100755 --- a/src/etc/init.c +++ b/src/etc/init.c @@ -24,6 +24,12 @@ int init(){ load_styles(); param_dev_defs(); get_monitor_sizes(); + + + if(check_directorys()){ + return 1; + } + if(check_compat_version()){ char msg[300]; sprintf(msg, "Versão do banco de dados não é compativel com a versão do App ( ver. %s )", GET_APP_VERSION()); diff --git a/src/etc/libs.c b/src/etc/libs.c index 11852dec..026ba6a9 100755 --- a/src/etc/libs.c +++ b/src/etc/libs.c @@ -27,6 +27,7 @@ #include "./pega_data.c" #include "./update_version.c" #include "./check_db.c" +#include "./check_dirs.c" #include "../Menu/iconview.c" #include "../Menu/abas.c" @@ -170,6 +171,10 @@ #include "../Relatorios/fixados/financeiro/receber/principal.c" #include "../Relatorios/fixados/financeiro/pagar/principal.c" +#include "../Relatorios/planilhas/iconview.c" +#include "../Relatorios/planilhas/init_export.c" +#include "../Relatorios/planilhas/gerar.c" + #include "../Marketing/analises/analisar.c" #include "../Marketing/emails/enviar/envio_emails.c" #include "../Marketing/emails/modelar/modela_email.c" diff --git a/src/etc/libs.h b/src/etc/libs.h index 445dd008..60bc05fd 100644 --- a/src/etc/libs.h +++ b/src/etc/libs.h @@ -21,6 +21,7 @@ #include "./impressao.h" #include "./vars.h" #include "./check_db.h" +#include "./check_dirs.h" #include "./stoi.h" #include "./css.h" @@ -174,6 +175,11 @@ #include "../Relatorios/fixados/financeiro/receber/principal.h" #include "../Relatorios/fixados/financeiro/pagar/principal.h" +#include "../Relatorios/planilhas/iconview.h" +#include "../Relatorios/planilhas/init_export.h" +#include "../Relatorios/planilhas/gerar.h" + + #include "../Marketing/analises/analisar.h" #include "../Marketing/emails/enviar/envio_emails.h" #include "../Marketing/emails/modelar/modela_email.h" diff --git a/src/etc/tools.c b/src/etc/tools.c index fd06ebcb..356bf0e9 100755 --- a/src/etc/tools.c +++ b/src/etc/tools.c @@ -1,5 +1,16 @@ #include "sql_tools.c" +void menu_icon_view_select(GtkIconView *icon_view, GtkTreePath *path, gpointer data){ + + if(menu_notebook && GTK_IS_WIDGET(menu_notebook)) + menu_notebook_atual_pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(menu_notebook)); + if(data && GTK_IS_WIDGET(data)){ + gtk_widget_destroy(data); + } + +} + + void remover_barra_n(char *string){ for(int cont=0;cont