<?php
-$styles->add("
+JavaScript::instance()->file('lib/rico3/minsrc/ricoLiveGridControls.js');
+
+Styles::instance()->add("
div#form_price {
padding-left: 10px;
padding-right: 10px;
<label for="form_steuer">Steuersatz</label><br>
<input id="form_steuer" name="steuer" size="10">
<br>
-<label for="form_preis">Preis</label><br>
+<label for="form_preis">Nettopreis</label><br>
<input id="form_preis" name="preis" size="10">
<div class="buttons" style="margin-top: 15px;">
<button class="custom" onclick="return add_price(this);">Hinzufügen</button>
if (artnr.value == 0) return form_save(custom_this);
- var parms = 'source=' + source.innerHTML + '&callback=artnr';
+ var parms = 'callback=artnr';
parms += '&artnr=' + artnr.value;
parms += '&artikel=' + id.value;
ajax_request('function', parms, custom_save_callback);
if (artnr.value == 0) return form_insert(custom_this);
- var parms = 'source=' + source.innerHTML + '&callback=artnr';
+ var parms = 'callback=artnr';
parms += '&artnr=' + artnr.value;
ajax_request('function', parms, custom_insert_callback);
var options = { hideOnClick: false, canDragFunc: true };
var content = 'CONTENT_FORM';
- price_popup = new Rico.Popup(options, false, false);
- price_popup.createWindow('<strong>Verbinden</strong>',content,'auto','130px');
+ price_popup = new Rico.Window('Preis hinzufügen', options);
+ price_popup.contentDiv.innerHTML = content;
- price_popup.openPopup(100,300);
+ price_popup.centerPopup();
} else
price_popup.openPopup();
- price_popup.titleDiv.childNodes[0].innerHTML = 'Preis hinzufügen';
-
var form_id = document.getElementById('edit_id');
var artikel = document.getElementById('form_artikel');
artikel.value = form_id.value;
- var datum = document.getElementById('form_datum');
- var preis = document.getElementById('form_preis');
- if (datum.value.length)
- preis.activate();
+ if ($('#form_datum').val().length)
+ $('#form_preis').select();
else
- datum.activate();
+ $('#form_datum').select();
}
function open_popup()
{
- var eid = document.getElementById('edit_id');
- if (!eid || !eid.value.length) return false;
+ if (!$('#edit_id').val().length) return false;
price_popup_open();
return false;
function add_price_callback(data)
{
info('Preis gespeichert');
- grid_update(grid);
+ grid_update(Hallinta.grid);
}
function add_price(obj)
{
- price_popup.closePopup();
-
var datum = document.getElementById('form_datum');
if (!datum.value.length) {
error('Kein Rechnungsdatum angegeben');
return false;
}
- var source = document.getElementById('source');
- if (!source) return false;
-
- var parms = 'source=' + source.innerHTML + '&callback=price&';
- ajax_request('function', parms+Form.serialize(obj.form), add_price_callback);
+ var parms = 'callback=price&' + $(obj.form).serialize();
+ ajax_request('function', parms, add_price_callback);
+ price_popup.closePopup();
preis.value = '';
return false;
$jscode = str_replace('CONTENT_FORM', str_replace(array("\n"),
array("\\\n"), $form), $jscode);
-$javascript->add($jscode);
-$javascript->onLoad("\$('button_save').onclick = function () {return custom_save(this);};");
-$javascript->onLoad("\$('button_insert').onclick = function () {return custom_insert(this);};");
+JavaScript::instance()->add($jscode);
+JavaScript::instance()->onLoad("\$('#button_save').click(function () {return custom_save(this);});");
+JavaScript::instance()->onLoad("\$('#button_insert').click(function () {return custom_insert(this);});");
$buttons = <<<EOC
<p style="margin-top: 5px; margin-bottom: 4px; text-align: center;">
'name' => 'ArtNr',
'width' => 60,
'type' => 'number',
- 'specs' => "decPlaces: 0, thouSep: '', filterUI: 't='",
+ 'filter' => 't=3',
+ 'specs' => array('decPlaces' => 0, 'thouSep' => ''),
),
'menge' => array(
'name' => 'Menge',
'width' => 60,
- 'specs' => "ClassName: 'alignrightpad', filterUI: 't3'",
+ 'filter' => 't3',
+ 'specs' => array('ClassName' => 'alignrightpad'),
),
'bezeichnung' => array(
'name' => 'Bezeichnung',
'width' => 300,
- 'specs' => "filterUI: 't'",
+ 'filter' => 't',
),
'netto' => array(
'name' => 'netto',
'width' => 60,
'type' => 'number',
- 'specs' => "decPlaces: 2, ClassName: 'alignrightpad'",
+ 'specs' => array('decPlaces' => 2, 'ClassName' => 'alignrightpad'),
'sql' => '(SELECT preis FROM metro_artikel_preis ' .
'WHERE artikel = metro_artikel.id ORDER BY datum DESC LIMIT 1)',
),
'name' => 'Preis',
'width' => 60,
'type' => 'number',
- 'specs' => "decPlaces: 2, ClassName: 'alignrightpad'",
+ 'specs' => array('decPlaces' => 2, 'ClassName' => 'alignrightpad'),
'sql' => '(SELECT preis * ((100 + steuersatz)/100) FROM metro_artikel_preis ' .
'WHERE artikel = metro_artikel.id ORDER BY datum DESC LIMIT 1)',
),
'hersteller' => array(
'name' => 'Hersteller',
'width' => 100,
- 'specs' => "filterUI: 't'",
+ 'filter' => 't4',
),
'abteilung' => array(
'name' => 'Abteilung',
'width' => 200,
- 'specs' => "filterUI: 's'",
+ 'filter' => 's',
'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_abteilung','id','name').", 0, '')",
'distinct' => "SELECT DISTINCT abteilung,metro_abteilung.name FROM metro_artikel JOIN metro_abteilung ON abteilung = metro_abteilung.id ORDER BY name",
'visible' => false,
'gang' => array(
'name' => 'Gang',
'width' => 50,
- 'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+ 'filter' => 's',
+ 'specs' => array('ClassName' => 'aligncenter'),
'visible' => false,
),
'vpe' => array(
'name' => 'Einheit',
'width' => 70,
- 'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+ 'filter' => 's',
+ 'specs' => array('ClassName' => 'aligncenter'),
'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_vpe','id','name').", 0, '')",
'distinct' => "SELECT DISTINCT vpe,metro_vpe.name FROM metro_artikel JOIN metro_vpe ON vpe = metro_vpe.id ORDER BY name",
),
),
),
'second' => array(
+ 'pricelist' => array(
'title' => 'Preisverlauf',
'rows' => 5,
'table' => 'metro_artikel_preis',
'list' => array(
'id' => array(
'name' => 'ID',
- 'edit' => "Writeable:false, EntryType: 'H', Length: 4, isKey: true",
+ 'edit' => array('Writeable' => false, 'EntryType' => 'H', 'Length' => 4, 'isKey' => true),
'visible' => false,
),
'datum' => array(
'name' => 'Datum',
'width' => 180,
- 'edit' => "EntryType: 'T', isNullable: false, Writeable: true",
+ 'edit' => array('EntryType' => 'T', 'isNullable' => false, 'Writeable' => true),
),
'steuersatz' => array(
'name' => 'Steuer',
'width' => 60,
'type' => 'number',
- 'specs' => "decPlaces: 2, ClassName: 'alignrightpad'",
- 'edit' => "EntryType: 'T', isNullable: false, Writeable: true",
+ 'specs' => array('decPlaces' => 2, 'ClassName' => 'alignrightpad'),
+ 'edit' => array('EntryType' => 'T', 'isNullable' => false, 'Writeable' => true),
),
'preis' => array(
'name' => 'netto',
'width' => 60,
'type' => 'number',
- 'specs' => "decPlaces: 2, ClassName: 'alignrightpad'",
- 'edit' => "EntryType: 'T', isNullable: false, Writeable: true",
+ 'specs' => array('decPlaces' => 2, 'ClassName' => 'alignrightpad'),
+ 'edit' => array('EntryType' => 'T', 'isNullable' => false, 'Writeable' => true),
),
'brutto' => array(
'name' => 'Preis',
'width' => 60,
'type' => 'number',
- 'specs' => "decPlaces: 2, ClassName: 'alignrightpad'",
+ 'specs' => array('decPlaces' => 2, 'ClassName' => 'alignrightpad'),
'sql' => 'preis * ((100 + steuersatz)/100)',
),
'empty' => array(
'name' => '',
- 'width' => 10,
+ 'width' => 20,
'sql' => "''",
),
),
),
+ ),
'callbacks' => array(
'price' => cb_price,
'artnr' => cb_artnr,