Subversion Repositories SmartDukaan

Rev

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

Rev 35806 Rev 35884
Line 1168... Line 1168...
1168
                newSerialNumber: newSerial.trim()
1168
                newSerialNumber: newSerial.trim()
1169
            });
1169
            });
1170
        }
1170
        }
1171
    });
1171
    });
1172
 
1172
 
1173
    // Collect non-serialized qty corrections
1173
    // Collect item corrections (serialized or non-serialized)
1174
    var qtyCorrections = [];
1174
    var qtyCorrections = [];
1175
    $('#qty-corrections-table > tbody > tr').each(function () {
1175
    $('#qty-corrections-table > tbody > tr').each(function () {
1176
        var oldItemId = $(this).find('.qty-old-itemid').val();
1176
        var oldItemId = $(this).find('.qty-old-itemid').val();
1177
        var newItemId = $(this).find('.qty-new-itemid').val();
1177
        var newItemId = $(this).find('.qty-new-itemid').val();
-
 
1178
        var serial = $(this).find('.qty-serial').val();
1178
        var qty = parseInt($(this).find('.qty-correction-val').val());
1179
        var qty = parseInt($(this).find('.qty-correction-val').val());
1179
 
1180
 
-
 
1181
        // For serialized items with IMEI, default qty to 1
-
 
1182
        if (oldItemId && newItemId && serial && serial.trim() !== '') {
-
 
1183
            qtyCorrections.push({
-
 
1184
                oldItemId: parseInt(oldItemId),
-
 
1185
                newItemId: parseInt(newItemId),
-
 
1186
                qty: qty > 0 ? qty : 1,
-
 
1187
                serialNumber: serial.trim()
-
 
1188
            });
1180
        if (oldItemId && newItemId && qty > 0) {
1189
        } else if (oldItemId && newItemId && qty > 0) {
1181
            qtyCorrections.push({
1190
            qtyCorrections.push({
1182
                oldItemId: parseInt(oldItemId),
1191
                oldItemId: parseInt(oldItemId),
1183
                newItemId: parseInt(newItemId),
1192
                newItemId: parseInt(newItemId),
1184
                qty: qty
1193
                qty: qty
1185
            });
1194
            });