2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Print reports for multiple selected sales orders / purchase orders

This commit is contained in:
Oliver Walters 2021-03-11 14:15:31 +11:00
parent fa95759a00
commit 7ccd339b5c
3 changed files with 74 additions and 28 deletions

View File

@ -15,18 +15,24 @@ InvenTree | {% trans "Purchase Orders" %}
<div id='table-buttons'> <div id='table-buttons'>
<div class='button-toolbar container-fluid' style='float: right;'> <div class='button-toolbar container-fluid' style='float: right;'>
{% if roles.purchase_order.add %} <div class='btn-group'>
<button class='btn btn-primary' type='button' id='po-create' title='{% trans "Create new purchase order" %}'> {% if roles.purchase_order.add %}
<span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}</button> <button class='btn btn-primary' type='button' id='po-create' title='{% trans "Create new purchase order" %}'>
{% endif %} <span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}
<button class='btn btn-default' type='button' id='view-calendar' title='{% trans "Display calendar view" %}'> </button>
<span class='fas fa-calendar-alt'></span> {% endif %}
</button> <button id='order-print' class='btn btn-default' title='{% trans "Print Order Reports" %}'>
<button class='btn btn-default' type='button' id='view-list' title='{% trans "Display list view" %}'> <span class='fas fa-print'></span>
<span class='fas fa-th-list'></span> </button>
</button> <button class='btn btn-default' type='button' id='view-calendar' title='{% trans "Display calendar view" %}'>
<div class='filter-list' id='filter-list-purchaseorder'> <span class='fas fa-calendar-alt'></span>
<!-- An empty div in which the filter list will be constructed --> </button>
<button class='btn btn-default' type='button' id='view-list' title='{% trans "Display list view" %}'>
<span class='fas fa-th-list'></span>
</button>
<div class='filter-list' id='filter-list-purchaseorder'>
<!-- An empty div in which the filter list will be constructed -->
</div>
</div> </div>
</div> </div>
</div> </div>
@ -154,6 +160,18 @@ $("#view-list").click(function() {
$("#view-calendar").show(); $("#view-calendar").show();
}); });
$("#order-print").click(function() {
var rows = $("#purchase-order-table").bootstrapTable('getSelections');
var orders = [];
rows.forEach(function(row) {
orders.push(row.pk);
});
printPurchaseOrderReports(orders);
})
$("#po-create").click(function() { $("#po-create").click(function() {
launchModalForm("{% url 'po-create' %}", launchModalForm("{% url 'po-create' %}",
{ {

View File

@ -15,18 +15,24 @@ InvenTree | {% trans "Sales Orders" %}
<div id='table-buttons'> <div id='table-buttons'>
<div class='button-toolbar container-fluid' style='float: right;'> <div class='button-toolbar container-fluid' style='float: right;'>
{% if roles.sales_order.add %} <div class='btn-group'>
<button class='btn btn-primary' type='button' id='so-create' title='{% trans "Create new sales order" %}'> {% if roles.sales_order.add %}
<span class='fas fa-plus-circle'></span> {% trans "New Sales Order" %}</button> <button class='btn btn-primary' type='button' id='so-create' title='{% trans "Create new sales order" %}'>
{% endif %} <span class='fas fa-plus-circle'></span> {% trans "New Sales Order" %}
<button class='btn btn-default' type='button' id='view-calendar' title='{% trans "Display calendar view" %}'> </button>
<span class='fas fa-calendar-alt'></span> {% endif %}
</button> <button id='order-print' class='btn btn-default' title='{% trans "Print Order Reports" %}'>
<button class='btn btn-default' type='button' id='view-list' title='{% trans "Display list view" %}'> <span class='fas fa-print'></span>
<span class='fas fa-th-list'></span> </button>
</button> <button class='btn btn-default' type='button' id='view-calendar' title='{% trans "Display calendar view" %}'>
<div class='filter-list' id='filter-list-salesorder'> <span class='fas fa-calendar-alt'></span>
<!-- An empty div in which the filter list will be constructed --> </button>
<button class='btn btn-default' type='button' id='view-list' title='{% trans "Display list view" %}'>
<span class='fas fa-th-list'></span>
</button>
<div class='filter-list' id='filter-list-salesorder'>
<!-- An empty div in which the filter list will be constructed -->
</div>
</div> </div>
</div> </div>
</div> </div>
@ -156,10 +162,30 @@ loadSalesOrderTable("#sales-order-table", {
url: "{% url 'api-so-list' %}", url: "{% url 'api-so-list' %}",
}); });
$("#order-print").click(function() {
var rows = $("#sales-order-table").bootstrapTable('getSelections');
var orders = [];
rows.forEach(function(row) {
orders.push(row.pk);
});
printSalesOrderReports(orders);
})
$("#so-create").click(function() { $("#so-create").click(function() {
launchModalForm("{% url 'so-create' %}", launchModalForm("{% url 'so-create' %}",
{ {
follow: true, follow: true,
secondary: [
{
field: 'customer',
label: '{% trans "New Customer" %}',
title: '{% trans "Create new Customer" %}',
url: '{% url "customer-create" %}',
}
]
} }
); );
}); });

View File

@ -139,8 +139,9 @@ function loadPurchaseOrderTable(table, options) {
columns: [ columns: [
{ {
field: 'pk', field: 'pk',
title: 'ID', title: '',
visible: false, visible: true,
checkbox: true,
switchable: false, switchable: false,
}, },
{ {
@ -235,8 +236,9 @@ function loadSalesOrderTable(table, options) {
columns: [ columns: [
{ {
field: 'pk', field: 'pk',
title: 'ID', title: '',
visible: false, checkbox: true,
visible: true,
switchable: false, switchable: false,
}, },
{ {