Cambios varios
This commit is contained in:
parent
6194aea70a
commit
037e391279
|
@ -15,4 +15,3 @@
|
|||
</item>
|
||||
</menu>
|
||||
</interface>
|
||||
|
||||
|
|
|
@ -3,7 +3,15 @@
|
|||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<requires lib="vn" version="1.0"/>
|
||||
<object class="VnBatch" id="models">
|
||||
<object class="VnBatch" id="batch">
|
||||
<items>
|
||||
<item id="year" param=""/>
|
||||
<item id="week" param=""/>
|
||||
<item id="store" param=""/>
|
||||
<item id="item" param=""/>
|
||||
</items>
|
||||
</object>
|
||||
<object class="VnSet" id="models">
|
||||
<child>
|
||||
<object class="VnModel" id="model-tickets">
|
||||
<property name="sql">SET @ini = TIMESTAMPADD(WEEK, #week, CONCAT(#year,'-01-01'));
|
||||
|
@ -42,12 +50,7 @@ SELECT
|
|||
ORDER BY t.Fecha, t.Id_Ticket;
|
||||
</property>
|
||||
<property name="result_pos">2</property>
|
||||
<batch>
|
||||
<holder id="year" param="param-year"/>
|
||||
<holder id="week" param="param-week"/>
|
||||
<holder id="store" param="param-store"/>
|
||||
<holder id="item" param="param-item"/>
|
||||
</batch>
|
||||
<property name="batch">batch</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -65,12 +68,12 @@ SELECT
|
|||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="grid">
|
||||
<object class="GtkScrolledWindow" id="scrolled-tickets">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="VnGrid" id="grid1">
|
||||
<object class="VnGrid" id="grid-tickets">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="iterator">iterator-tickets</property>
|
||||
|
@ -207,12 +210,12 @@ SELECT
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<object class="GtkBox" id="box-bottom">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<object class="GtkLabel" id="label-total">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
|
@ -229,7 +232,7 @@ SELECT
|
|||
<property name="width_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="param">calc-sum</property>
|
||||
<property name="master">calc-sum</property>
|
||||
<property name="format">%.0f</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkLabel" id="label-widget1">
|
||||
|
@ -252,18 +255,4 @@ SELECT
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="VnBatch" id="params">
|
||||
<child>
|
||||
<object class="GvnParam" id="param-item"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GvnParam" id="param-store"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GvnParam" id="param-week"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GvnParam" id="param-year"/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
230
data/weeks.glade
230
data/weeks.glade
|
@ -2,6 +2,7 @@
|
|||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<requires lib="" version="3.12"/>
|
||||
<requires lib="vn" version="1.0"/>
|
||||
<!-- interface-css-provider-path comparative.css -->
|
||||
<object class="GtkAdjustment" id="adjustment">
|
||||
|
@ -9,12 +10,18 @@
|
|||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="VnBatch" id="models">
|
||||
<object class="VnBatch" id="batch-weeks">
|
||||
<items>
|
||||
<item id="store" param="field-store"/>
|
||||
<item id="type" param="param-type"/>
|
||||
</items>
|
||||
</object>
|
||||
<object class="VnSet" id="models">
|
||||
<child>
|
||||
<object class="VnModel" id="model-types">
|
||||
<property name="sql">SELECT tipo_id, Tipo FROM Tipos WHERE #link ORDER BY Tipo</property>
|
||||
<links>
|
||||
<link field="Tipos.reino_id" param="param-realm" linked="True"/>
|
||||
<link field="Tipos.reino_id" param="field-realm" linked="True"/>
|
||||
</links>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -36,18 +43,15 @@
|
|||
<child>
|
||||
<object class="VnModel" id="model-weeks">
|
||||
<property name="sql">CALL comparative_test (#from, #days, #store, #type, NULL)</property>
|
||||
<batch>
|
||||
<holder id="store" param="param-store"/>
|
||||
<holder id="type" param="param-type"/>
|
||||
</batch>
|
||||
<property name="batch">batch-weeks</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="VnBatch" id="calcs">
|
||||
<object class="VnSet" id="calcs">
|
||||
<child>
|
||||
<object class="DbCalc" id="calc-available">
|
||||
<property name="model">model-weeks</property>
|
||||
<property name="column_name">available</property>
|
||||
<property name="column_name">avalaible</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -81,7 +85,7 @@
|
|||
<object class="VnLabel" id="sum-available">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="param">calc-available</property>
|
||||
<property name="master">calc-available</property>
|
||||
<property name="format">%.0f</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkLabel" id="label-widget1">
|
||||
|
@ -119,7 +123,7 @@
|
|||
<object class="VnLabel" id="sum-visible">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="param">calc-visible</property>
|
||||
<property name="master">calc-visible</property>
|
||||
<property name="format">%.0f</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkLabel" id="label-widget2">
|
||||
|
@ -133,7 +137,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="VnBatch" id="iterators">
|
||||
<object class="VnSet" id="iterators">
|
||||
<child>
|
||||
<object class="VnIterator" id="iterator-types">
|
||||
<property name="model">model-types</property>
|
||||
|
@ -152,20 +156,172 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="VnBatch" id="params">
|
||||
<child>
|
||||
<object class="GvnParam" id="param-realm"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GvnParam" id="param-color"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GvnParam" id="param-store"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GvnParam" id="param-filter"/>
|
||||
<object class="GtkDialog" id="dialog-swap">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Swap item</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<signal name="response" handler="vn_weeks_on_swap_response" swapped="yes"/>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action-area">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid-swap">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">4</property>
|
||||
<property name="row_spacing">4</property>
|
||||
<property name="column_spacing">4</property>
|
||||
<property name="row_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-swap">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Change:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-for">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">For:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="VnEntry" id="swap-item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkEntry" id="entry-widget1">
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="VnEntry" id="swap-for">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkEntry" id="entry-widget2">
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-from">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">From:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-to">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">To:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="VnDateChooser" id="swap-from">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkToggleButton" id="date-chooser-widget3">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">half</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="VnDateChooser" id="swap-to">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkToggleButton" id="date-chooser-widget4">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">half</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkImage" id="image-swap">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">view-refresh-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkBox" id="main">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -177,7 +333,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="width_request">350</property>
|
||||
<property name="width_request">380</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="vadjustment">adjustment</property>
|
||||
|
@ -188,7 +344,6 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="search_column">0</property>
|
||||
<property name="enable_grid_lines">horizontal</property>
|
||||
<property name="iterator">iterator-weeks</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="grid-selection">
|
||||
|
@ -252,7 +407,7 @@
|
|||
<child>
|
||||
<object class="VnColumnSpin" id="column-available">
|
||||
<property name="widget">title-available</property>
|
||||
<property name="column_name">available</property>
|
||||
<property name="column_name">avalaible</property>
|
||||
<child internal-child="cell">
|
||||
<object class="GtkCellRendererSpin" id="column-spin-cell2">
|
||||
<property name="background_rgba">rgb(204,255,198)</property>
|
||||
|
@ -278,7 +433,6 @@
|
|||
<object class="VnGrid" id="grid-weeks">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="enable_grid_lines">horizontal</property>
|
||||
<property name="iterator">iterator-weeks</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="grid-selection1">
|
||||
|
@ -388,13 +542,7 @@
|
|||
<object class="VnCombo" id="field-store">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="param">param-store</property>
|
||||
<property name="model">model-store</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkComboBox" id="combo-widget1">
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -417,7 +565,6 @@
|
|||
<object class="VnCombo" id="field-realm">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="param">param-realm</property>
|
||||
<property name="model">model-realm</property>
|
||||
<child internal-child="widget">
|
||||
<object class="GtkComboBox" id="combo-widget2">
|
||||
|
@ -472,6 +619,21 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">Swap item</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image-swap</property>
|
||||
<signal name="clicked" handler="vn_weeks_on_swap_clicked" swapped="yes"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
|
@ -21,11 +21,9 @@ public class Vn.WeekTickets : Vn.Form
|
|||
{
|
||||
public WeekTickets () {}
|
||||
|
||||
public override void open (Gtk.Builder builder)
|
||||
public override void open ()
|
||||
{
|
||||
(get ("param-year") as Gvn.Param).value = 2014;
|
||||
(get ("param-week") as Gvn.Param).value = 28;
|
||||
(get ("param-store") as Gvn.Param).value = 0;
|
||||
(get ("param-item") as Gvn.Param).value = 1;
|
||||
var batch = new Sql.Batch ();
|
||||
(get ("model-tickets") as Db.Model).batch = batch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,12 @@ public class Vn.Weeks : Vn.Form
|
|||
|
||||
public Weeks () {}
|
||||
|
||||
public override void open (Gtk.Builder builder)
|
||||
public override void open ()
|
||||
{
|
||||
var dialog = get ("dialog-swap") as Gtk.Dialog;
|
||||
dialog.add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
|
||||
dialog.add_button (_("Apply"), Gtk.ResponseType.ACCEPT);
|
||||
|
||||
// Generating the week columns
|
||||
|
||||
titles = new TitleData[N_COLS];
|
||||
|
@ -87,12 +91,12 @@ public class Vn.Weeks : Vn.Form
|
|||
title.attach (calc_label, 0, 1, 1, 1);
|
||||
|
||||
var context = calc_label.get_style_context ();
|
||||
context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);3
|
||||
|
||||
var calc = new Db.Calc ();
|
||||
calc.model = get ("model-weeks") as Db.Model;
|
||||
calc.type = Db.CalcType.SUM;
|
||||
calc_label.param = calc;
|
||||
calc_label.master = calc;
|
||||
|
||||
title.show_all ();
|
||||
|
||||
|
@ -105,13 +109,13 @@ public class Vn.Weeks : Vn.Form
|
|||
|
||||
// Configuring params
|
||||
|
||||
batch = (get ("model-weeks") as Db.Model).batch;
|
||||
batch = get ("batch-weeks") as Sql.Batch;
|
||||
|
||||
var today = new DateTime.now_local ();
|
||||
(get ("field-from") as Vn.Field).value = today;
|
||||
(get ("field-to") as Vn.Field).value = today.add_days (1);
|
||||
(get ("field-store") as Vn.Field).value = 0;
|
||||
(get ("field-realm") as Vn.Field).value = 1;
|
||||
(get ("field-from") as Gvn.Param).value = today;
|
||||
(get ("field-to") as Gvn.Param).value = today.add_days (1);
|
||||
(get ("field-store") as Gvn.Param).value = 0;
|
||||
(get ("field-realm") as Gvn.Param).value = 1;
|
||||
}
|
||||
|
||||
private void set_week_columns_source ()
|
||||
|
@ -120,8 +124,8 @@ public class Vn.Weeks : Vn.Form
|
|||
|
||||
for (int i = 0; i < N_COLS; i++)
|
||||
{
|
||||
var nweek = i % N_WEEKS + 1;
|
||||
var year = i % N_YEARS != 0 ? 'c' : 'l';
|
||||
var nweek = i / N_YEARS + 1;
|
||||
var column_name = "%cweek%d".printf (year, nweek);
|
||||
|
||||
var column = grid_weeks.get_column (i) as Vn.Column;
|
||||
|
@ -150,8 +154,8 @@ public class Vn.Weeks : Vn.Form
|
|||
|
||||
public void on_to_changed ()
|
||||
{
|
||||
DateTime * from = (get ("field-from") as Vn.Field).get_value ().get_boxed ();
|
||||
DateTime * to = (get ("field-to") as Vn.Field).get_value ().get_boxed ();
|
||||
DateTime * from = (get ("field-from") as Gvn.Param).get_value ().get_boxed ();
|
||||
DateTime * to = (get ("field-to") as Gvn.Param).get_value ().get_boxed ();
|
||||
|
||||
TimeSpan diff = 0;
|
||||
|
||||
|
@ -160,4 +164,32 @@ public class Vn.Weeks : Vn.Form
|
|||
|
||||
batch.add_from_value ("days", diff);
|
||||
}
|
||||
|
||||
public void on_swap_clicked (Gtk.Button button)
|
||||
{
|
||||
var dialog = get ("dialog-swap") as Gtk.Dialog;
|
||||
dialog.set_transient_for (get_toplevel () as Gtk.Window);
|
||||
dialog.show_all ();
|
||||
}
|
||||
|
||||
public void on_swap_response (int response, Gtk.Dialog dialog)
|
||||
{
|
||||
if (response == Gtk.ResponseType.ACCEPT)
|
||||
{
|
||||
print ("Reponse!");
|
||||
}
|
||||
|
||||
dialog.hide ();
|
||||
}
|
||||
|
||||
public void on_week_clicked ()
|
||||
{
|
||||
var form = gui.open_form ("week-tickets");
|
||||
form.setParams (
|
||||
"year", 2014
|
||||
,"week", 29
|
||||
,"store", (get ("field-store") as Gvn.Param).value
|
||||
,"item", (get ("iterator-weeks") as Db.Iterator).get_value ("Id_Article")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue