stock_values.js 2.32 KB
Newer Older
1 2 3 4 5 6 7 8

$(document).ready(function() {
    table_article = $('#tableArticle').DataTable({
        "ajax": {
            "url": "get_valuable_stock",
            "data": ""
        },
        "columns":[
9
            {data:"barcode", "title":"Code-barre", "width": "10em"},
10 11
            {data:"display_name", "title":"Article", "width": "50%"},

12 13 14 15 16 17 18 19
            {data:"qty_available", "title":"Stock", "width":"5em",
             render: function(data) {
               if (data == parseInt(data,10)) {
		  return data
               } else {
                  return data.toFixed(3)
	       }
             }
20
            },
21 22 23 24
            {data:"standard_price", "title":"Prix Achat", "width":"4em",
             render: function(data) {
               return data.toFixed(2)
             }
25

26 27 28 29 30 31
            },
            {data: "total", "title": "Total",
             render: function(data, type, full) {
               return data.toFixed(2)
             }
            }
32 33 34 35 36 37 38 39 40 41

        ],

        "searching": true,
        "order": [
            [
                2,
                "desc"
            ]
        ],
42
        "paging": true,
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
        "language": {
            "emptyTable":     "Pas de donnée",
            "info":           "Affiché : lignes _START_ à _END_ sur _TOTAL_",
            "infoEmpty":      "Affiché : 0 ligne",
            "infoFiltered":   "(filtré de _MAX_ lignes au total)",
            "thousands":      ",",
            "lengthMenu":     "Afficher _MENU_ lignes",
            "loadingRecords": "Loading...",
            "processing":     "Processing...",
            "search":         "Rechercher un article :",
            "searchPlaceholder": "Référence, code-barre",
            "zeroRecords":    "Aucun résultat",
            "paginate": {
                "first":      "Premier",
                "last":       "Dernier",
                "next":       "Suivant",
                "previous":   "Precedant"
            },
            "aria": {
                "sortAscending":  ": activate to sort column ascending",
                "sortDescending": ": activate to sort column descending"
            }
        },
        buttons: [
            {
                extend: 'excelHtml5',
                text: 'Export en Excel',
                className: 'btn--primary btn_export'
            },
        ],
73
        dom: '<lr<t>ip><"clear"><B>'
74
    });
75
});