epic-ts
[kivitendo-erp.git] / templates / webpages / ic / sales_price_information.html
1 <div id='sales_price_information_sales_order'></div>
2 <div id='sales_price_information_sales_quotation'></div>
3
4 <script type='text/javascript'>
5   function get_report(target, source, data){
6     $.ajax({
7       url:        source,
8 //      beforeSend: function () { $(target).html('<img src="image/spinner.gif">') },
9       success:    function (rsp) {
10         $(target).html(rsp);
11         $(target).find('.paginate').find('a').click(function(event){ redirect_event(event, target) });
12         $(target).find('a.report-generator-header-link').click(function(event){ redirect_event(event, target) });
13       },
14       data:       data,
15     });
16   };
17
18   function redirect_event(event, target){
19     event.preventDefault();
20     get_report(target, event.target + '', {});
21   }
22
23   $('.tabwidget').on('tabsbeforeactivate', function(event, ui){
24     if (ui.newPanel.attr('id') == 'sales_price_information') {
25       get_report('#sales_price_information_sales_order', 'controller.pl', { action: 'SellPriceInformation/list', 'filter.part.id': [% id %], 'filter.order.type': 'sales_order' });
26       get_report('#sales_price_information_sales_quotation', 'controller.pl', { action: 'SellPriceInformation/list', 'filter.part.id': [% id %], 'filter.order.type': 'sales_quotation' });
27     }
28     return 1;
29   });
30
31
32 </script>