Subversion Repositories SmartDukaan

Rev

Rev 37711 | Rev 37750 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37711 Rev 37723
Line 959... Line 959...
959
        }
959
        }
960
 
960
 
961
 
961
 
962
    }
962
    }
963
 
963
 
-
 
964
    // Rows typed by hand and rows filled from a bulk upload are checked alike: the screen is where the order is made.
-
 
965
    var overCap = [];
-
 
966
    $("table > tbody > tr").each(function () {
-
 
967
        if ($(this).find('.qty').hasClass('mv-over')) {
-
 
968
            overCap.push($(this).find('.typeaheaditem').val() + ': ' + $(this).find('.mv-qty-warn').text());
-
 
969
        }
-
 
970
    });
-
 
971
    if (overCap.length > 0) {
-
 
972
        alert("Reduce these quantities before creating the PO:\n\n" + overCap.join("\n"));
-
 
973
        return false;
-
 
974
    }
-
 
975
 
964
    purchaseOrder['vendorId'] = vendorId;
976
    purchaseOrder['vendorId'] = vendorId;
965
    purchaseOrder['warehouseId'] = warehouseId
977
    purchaseOrder['warehouseId'] = warehouseId
966
    purchaseOrder['sendPo'] = sendPo
978
    purchaseOrder['sendPo'] = sendPo
967
    purchaseOrder['poDate'] = poDate;
979
    purchaseOrder['poDate'] = poDate;
968
    purchaseOrder['items'] = items
980
    purchaseOrder['items'] = items
Line 1405... Line 1417...
1405
    }
1417
    }
1406
 
1418
 
1407
    var cap = pricing.movableOnThisPo;
1419
    var cap = pricing.movableOnThisPo;
1408
    $row.data('movableOnThisPo', cap);
1420
    $row.data('movableOnThisPo', cap);
1409
 
1421
 
-
 
1422
    // Reads as a sum - in stock + arriving - promised - so the number that can move is never left unexplained.
1410
    var rows = mvAvailLine('In stock', pricing.inStock, '');
1423
    var rows = mvAvailLine('In stock', pricing.inStock, '');
-
 
1424
    if (pricing.arrivingTotal > 0) {
-
 
1425
        rows += mvAvailLine('Arriving (not yet received)', '+ ' + pricing.arrivingTotal, '');
-
 
1426
        $.each(pricing.arriving || [], function (i, po) {
-
 
1427
            rows += mvAvailLine(mvEscape(po.poNumber) + ' · ' + mvEscape(po.poDate)
-
 
1428
                + (po.destination ? ' ← ' + mvEscape(po.destination) : ''), po.qty, ' mv-po');
-
 
1429
        });
-
 
1430
    }
1411
    if (pricing.promisedTotal > 0) {
1431
    if (pricing.promisedTotal > 0) {
1412
        rows += mvAvailLine('Promised on open orders', pricing.promisedTotal, '');
1432
        rows += mvAvailLine('Promised on open orders', '− ' + pricing.promisedTotal, '');
1413
        $.each(pricing.promised || [], function (i, po) {
1433
        $.each(pricing.promised || [], function (i, po) {
1414
            rows += mvAvailLine(mvEscape(po.poNumber) + ' · ' + mvEscape(po.poDate)
1434
            rows += mvAvailLine(mvEscape(po.poNumber) + ' · ' + mvEscape(po.poDate)
1415
                + (po.destination ? ' → ' + mvEscape(po.destination) : ''), po.qty, ' mv-po');
1435
                + (po.destination ? ' → ' + mvEscape(po.destination) : ''), po.qty, ' mv-po');
1416
        });
1436
        });
1417
    }
1437
    }
1418
    if (pricing.inbound > 0) {
-
 
1419
        rows += mvAvailLine('Of these, still to arrive', pricing.inbound, ' mv-po');
-
 
1420
    }
-
 
1421
    rows += mvAvailLine('Can move on this PO', cap, ' mv-total');
1438
    rows += mvAvailLine('Can move on this PO', cap, ' mv-total');
1422
 
1439
 
1423
    var note = '';
1440
    var note = '';
1424
    if (pricing.costSplit) {
1441
    if (pricing.costSplit) {
1425
        note += '<div class="mv-note">' + (pricing.movableAltogether - cap)
1442
        note += '<div class="mv-note">' + (pricing.movableAltogether - cap)