Display date of last price on demand
[misc/hallinta-metro] / ordersatz_pos.php
index ace0584..65a7608 100644 (file)
@@ -73,7 +73,7 @@ function finish()
   return false;
 }
 
-function import_callback(data)
+function import_articles_callback(data)
 {
   if (data.status == true) {
     info('Ordersatz aktualisiert');
@@ -85,13 +85,13 @@ function import_callback(data)
   }
 }
 
-function import()
+function import_articles()
 {
   var source = document.getElementById('source');
   if (!source) return false;
 
   var parms = 'source=' + source.innerHTML + '&callback=import';
-  ajax_request('function', parms, import_callback);
+  ajax_request('function', parms, import_articles_callback);
   return false;
 }
 
@@ -99,7 +99,7 @@ EOC;
 
 $buttons = <<<EOC
 <p style="margin-top: 0px; margin-bottom: 4px; text-align: center;">
-<button onclick="return import()">Artikel importieren</button>
+<button onclick="return import_articles()">Artikel importieren</button>
 &nbsp;
 <button onclick="return build_pdf()">PDF erstellen</button>
 &nbsp;
@@ -142,13 +142,12 @@ $mask = array(
                              'artnr' => array(
                                            'name' => 'Artnr',
                                            'width' => 60,
-                                           'specs' => "filterUI: 't'",
                                            'visible' => false,
                                            ),
                              'menge' => array(
                                            'name' => 'Menge',
                                            'width' => 60,
-                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't'",
+                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't2'",
                                            ),
                              'bezeichnung' => array(
                                            'name' => 'Bezeichnung',
@@ -163,10 +162,18 @@ $mask = array(
                                            'sql' => '(SELECT preis * ((100 + steuersatz)/100) FROM metro_artikel_preis ' .
                                                     'WHERE artikel = metro_artikel.id ORDER BY datum DESC LIMIT 1)',
                                            ),
+                             'datum' => array(
+                                           'name' => 'Datum',
+                                           'width' => 85,
+                                           'type' => 'text',
+                                           'sql' => '(SELECT datum FROM metro_artikel_preis ' .
+                                                    'WHERE artikel = metro_artikel.id ORDER BY datum DESC LIMIT 1)',
+                                           'visible' => false,
+                                           ),
                              'hersteller' => array(
                                            'name' => 'Hersteller',
                                            'width' => 80,
-                                           'specs' => "filterUI: 't'",
+                                           'specs' => "filterUI: 't5'",
                                            ),
                              'vpe' => array(
                                            'name' => 'Einheit',