Ver Fonte

More functionality added.

mingodad há 13 anos atrás
pai
commit
433a312bfe

+ 86 - 0
SquiLu-ourbiz/barchart-gui.nut

@@ -0,0 +1,86 @@
+class BarChartGroup extends Fl_Group {
+  
+  // Declaration of class members
+  pack = null;
+  btnShowChart = null;
+  periodes_to_show = null;
+  btn_periode_is_years = null;
+  btn_periode_is_months = null;
+  btn_periode_is_weeks = null;
+  btn_periode_is_days = null;
+  chkOpt = null;
+  bar_chart = null;
+  
+  constructor(){
+    base.constructor(288, 260, 760, 460, _tr("BarChartGroup"));
+    local _x = 288, _y = 260;
+    // Create member functions and widgets
+    {
+      local o = Fl_Pack(_x + 0, _y + 0, 760, 25);
+      pack = o;
+      o.type(1);
+      o.labelsize(16);
+      o->spacing(10);
+      {
+        {
+          local o = Fl_Button(_x + 0, _y + 0, 96, 25, _tr("Show"));
+          btnShowChart = o;
+          o.labelsize(16);
+        }
+        {
+          local o = Fl_Int_Input(_x + 106, _y + 0, 80, 25);
+          periodes_to_show = o;
+          o.textsize(16);
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          o.tooltip(_tr("Write then number of periodes you want to see"));
+          o->value("12");
+        }
+        {
+          local o = Fl_Round_Button(_x + 196, _y + 0, 110, 25, _tr("Years"));
+          btn_periode_is_years = o;
+          o.labelsize(16);
+          o.type(102);
+          o.down_box(FL_ROUND_DOWN_BOX);
+        }
+        {
+          local o = Fl_Round_Button(_x + 316, _y + 0, 110, 25, _tr("Months"));
+          btn_periode_is_months = o;
+          o.labelsize(16);
+          o.type(102);
+          o.down_box(FL_ROUND_DOWN_BOX);
+          o->setonly();
+        }
+        {
+          local o = Fl_Round_Button(_x + 436, _y + 0, 110, 25, _tr("Weeks"));
+          btn_periode_is_weeks = o;
+          o.labelsize(16);
+          o.type(102);
+          o.down_box(FL_ROUND_DOWN_BOX);
+        }
+        {
+          local o = Fl_Round_Button(_x + 556, _y + 0, 110, 25, _tr("Days"));
+          btn_periode_is_days = o;
+          o.labelsize(16);
+          o.type(102);
+          o.down_box(FL_ROUND_DOWN_BOX);
+        }
+        {
+          local o = Fl_Check_Button(_x + 660, _y + 5, 64, 15);
+          chkOpt = o;
+          o.down_box(FL_DOWN_BOX);
+        }
+      }
+      o.end();
+    }
+    {
+      local o = Fl_Bar_Chart(_x + 0, _y + 30, 760, 430);
+      bar_chart = o;
+      o.align(5);
+      o.labeltype(FL_NO_LABEL);
+      o.labelsize(16);
+      o.color(7);
+      Fl_Group.current().resizable(o);
+    }
+  }
+}

+ 55 - 0
SquiLu-ourbiz/history-gui.nut

@@ -0,0 +1,55 @@
+class HistoryGroup extends Fl_Group {
+  
+  // Declaration of class members
+  history_choice = null;
+  history_query_limit = null;
+  btnViewDocHsitory = null;
+  grid_history = null;
+  
+  constructor(){
+    base.constructor(13, 33, 760, 465, _tr("History"));
+    local _x = 13, _y = 33;
+    // Create member functions and widgets
+    {
+      local o = Fl_Pack(_x + 0, _y + 0, 760, 25);
+      o.type(1);
+      o.labelsize(16);
+      o->spacing(10);
+      {
+        {
+          local o = Fl_Choice(_x + 0, _y + 0, 564, 25);
+          history_choice = o;
+          o.textsize(16);
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          o.down_box(FL_BORDER_BOX);
+          Fl_Group.current().resizable(o);
+        }
+        {
+          local o = Fl_Int_Input(_x + 574, _y + 0, 80, 25);
+          history_query_limit = o;
+          o.textsize(16);
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          o.tooltip(_tr("Write then number of periodes you want to see"));
+          o->value("50");
+        }
+        {
+          local o = Fl_Button(_x + 664, _y + 0, 96, 25, _tr("View Doc."));
+          btnViewDocHsitory = o;
+          o.labelsize(16);
+        }
+      }
+      o.end();
+    }
+    {
+      local o = Fl_Data_Table(_x + 0, _y + 33, 760, 432);
+      grid_history = o;
+      o.textsize(16);
+      o.labeltype(FL_NO_LABEL);
+      o.labelsize(16);
+      o.end();
+      Fl_Group.current().resizable(o);
+    }
+  }
+}

+ 62 - 2
SquiLu-ourbiz/ourbiz-fltk.nut

@@ -902,6 +902,9 @@ dofile("search-options.nut");
 dofile("utils-fltk.nut");
 dofile("help-view-gui.nut");
 dofile("help-view.nut");
+dofile("fl-bar-chart.nut");
+dofile("barchart-gui.nut");
+dofile("history-gui.nut");
 dofile("delivery-calc-gui.nut");
 dofile("calendar-gui.nut");
 dofile("calendar-utils.nut");
@@ -1044,8 +1047,12 @@ class OurSalesTax extends SalesTaxRatesEditWindow {
 	}
 }
 
-function print_entities_list_contact_report()
+function print_entities_list_contact_report(sender=null, udata=null)
 {
+	local mywin = sender ? sender.window() : null;
+	local progress = mywin ? mywin.print_progress : null;
+	if(progress) progress.maximum(10);
+	
 	local cursor_wait = fl_cursor_wait();
 	local mydata = [];
 	appServer.entities_toprint_get_list(mydata);
@@ -1101,23 +1108,64 @@ function print_entities_list_contact_report()
 	    printer.origin(30,25);
 	    printer.print_widget(report);
 	    printer.end_page();
+	    
+            //to allow user do something meanwhile
+            Fl_Display_Device.display_device()->set_current();
+	    if(progress) {
+		progress.label(_tr("Processing page ") + i);
+		progress.value(i % 10);
+	    }
+            Fl.check();
+            printer.set_current();
 	}
 	printer.end_job();
+	if(progress) {
+		progress.label(format(_tr("Processed %d pages"), npages));
+		progress.value(progress.maximum());
+	}
 }
 
 class MyEditEntityWindow extends EditEntityWindow {
 	_sab = null;
+	_ourBarChart = null;
+	_ourHistory = null;
+	static _history_options = [
+		"--- Select one",
+		"Sales by date",
+		"Sales by amount",
+		"Products bought",
+		"Products bought by value",
+		"Products bought by quantity",
+	];
+	
 	constructor(){
 		base.constructor();
 		dbUpdater()->table_name = "entities";
 		_sab = 'A';
 		setDbActionControls(dbAction, btnDbAction);
+		btnEntitesListContactReport.callback(print_entities_list_contact_report);
+		
+		_ourBarChart = new BarChartGroup();
+		replace_widget_for(tabChartStatistics, _ourBarChart);
+		_ourBarChart->btnShowChart.callback(on_show_chart_cb);
+		
+		_ourHistory = new HistoryGroup();
+		replace_widget_for(tabHistory, _ourHistory);
+		local choice =  _ourHistory->history_choice;
+		foreach(opt in _history_options)
+		    choice->add(_tr(opt));
+		choice->value(0);
+		choice.callback(on_history_cb);
 	}
 	function do_edit_delayed(udata)
 	{
 		base.do_edit_delayed(udata);
 		delayed_focus(db_entities_name);
 	}
+	function on_show_chart_cb(sender, udata){
+	}
+	function on_history_cb(sender, udata){
+	}
 }
 
 class EntitiesListSearch extends MyListSearchWindow {
@@ -1176,8 +1224,12 @@ class EntitiesListSearch extends MyListSearchWindow {
 	}
 }
 
-function print_products_list()
+function print_products_list(sender=null, udata=null)
 {
+	local mywin = sender ? sender.window() : null;
+	local progress = mywin ? mywin.print_progress : null;
+	if(progress) progress.maximum(10);
+
 	local cursor_wait = fl_cursor_wait();
 	local mydata = [];
 	appServer.products_list_get_list(mydata);
@@ -1238,10 +1290,18 @@ function print_products_list()
 
             //to allow user do something meanwhile
             Fl_Display_Device.display_device()->set_current();
+	    if(progress) {
+		progress.label(_tr("Processing page ") + i);
+		progress.value(i % 10);
+	    }
             Fl.check();
             printer.set_current();
 	}
 	printer.end_job();
+	if(progress) {
+		progress.label(format(_tr("Processed %d pages"), npages));
+		progress.value(progress.maximum());
+	}
 }
 
 class MyEditProductWindow extends EditProductWindow {