Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- function MakeFloat(sth) {
- return parseFloat(sth.text().replace(",", ".").replace(" ", ""));
- //return parseFloat(sth.html().replace(",",".").split(" ").join(""));
- }
- $('#table_dt').dataTable({
- "ordering": false,
- "pageLength": 100
- });
- $('#btnGreaterSpirb').on('change', function(e) {
- $('.diff').each(function() {
- var diffValue = parseFloat($(this).text());
- console.log(diffValue);
- if (diffValue > 0) {
- $(this).closest('tr').toggleClass('warning');
- }
- });
- });
- (function() {
- toSum = 0;
- diffSum = MakeFloat($('#diffSum'));
- $('tr#clickedRowToSum').on('click', function() {
- var amountInCell = MakeFloat($(this));
- if ($(this).hasClass('warning')) {
- toSum -= amountInCell;
- $('#clickedSum').text(toSum.toFixed(2));
- $(this).removeClass('warning');
- } else {
- toSum += amountInCell;
- $('#clickedSum').text(toSum.toFixed(2));
- $(this).addClass('warning');
- if (diffSum == toSum) {
- alert("Suma wybranych dyspozycji równa jest brakującej kwocie");
- }
- }
- });
- })()
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement