@softwear/latestcollectioncore 1.0.147 → 1.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -199,6 +199,7 @@ const buildVector = function (transaction) {
199
199
  return vector;
200
200
  }
201
201
  if (transaction.type == types_1.transactionTypeE.PICK_LIST) {
202
+ // Wholesale pickticket (P* in Foxpro)
202
203
  // Type 94 (PICK_LIST) should NOT set QTY_SHELF_STOCK
203
204
  // Picklists reduce shelfStock, which is handled by subtracting QTY_PICKLIST in postAgg
204
205
  const vector = new Float64Array(tv.COSTPRICE_PICKLIST + 1);
@@ -209,6 +210,18 @@ const buildVector = function (transaction) {
209
210
  vector[tv.COSTPRICE_PICKLIST] = (0, index_1.round2)(transaction.buyprice * transaction.qty);
210
211
  return vector;
211
212
  }
213
+ if (transaction.type == types_1.transactionTypeE.CONSIGNMENT) {
214
+ // Retail consignment (PN in Foxpro)
215
+ // Type 95 (CONSIGNMENT) should NOT set QTY_SHELF_STOCK
216
+ // Consignemt reduce shelfStock, which is handled by subtracting QTY_PICKLIST in postAgg
217
+ const vector = new Float64Array(tv.COSTPRICE_CONSIGNMENT + 1);
218
+ vector[tv.QTY_TRANSACTION] = transaction.qty;
219
+ // QTY_SHELF_STOCK is NOT set - picklists are subtracted separately via QTY_PICKLIST
220
+ vector[tv.QTY_CONSIGNMENT] = transaction.qty;
221
+ vector[tv.AMOUNT_CONSIGNMENT] = (0, index_1.round2)(transaction.sellprice * transaction.qty);
222
+ vector[tv.COSTPRICE_CONSIGNMENT] = (0, index_1.round2)(transaction.buyprice * transaction.qty);
223
+ return vector;
224
+ }
212
225
  if (transaction.type == types_1.transactionTypeE.RETURN_CUSTOMER) {
213
226
  const vector = new Float64Array(tv.COSTPRICE_B2B_RETURN + 1);
214
227
  vector[tv.QTY_TRANSACTION] = transaction.qty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.147",
3
+ "version": "1.0.148",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -215,6 +215,7 @@ const buildVector = function (transaction: TransactionI): Float64Array {
215
215
  }
216
216
 
217
217
  if (transaction.type == transactionTypeE.PICK_LIST) {
218
+ // Wholesale pickticket (P* in Foxpro)
218
219
  // Type 94 (PICK_LIST) should NOT set QTY_SHELF_STOCK
219
220
  // Picklists reduce shelfStock, which is handled by subtracting QTY_PICKLIST in postAgg
220
221
  const vector = new Float64Array(tv.COSTPRICE_PICKLIST + 1)
@@ -226,6 +227,19 @@ const buildVector = function (transaction: TransactionI): Float64Array {
226
227
  return vector
227
228
  }
228
229
 
230
+ if (transaction.type == transactionTypeE.CONSIGNMENT) {
231
+ // Retail consignment (PN in Foxpro)
232
+ // Type 95 (CONSIGNMENT) should NOT set QTY_SHELF_STOCK
233
+ // Consignemt reduce shelfStock, which is handled by subtracting QTY_PICKLIST in postAgg
234
+ const vector = new Float64Array(tv.COSTPRICE_CONSIGNMENT + 1)
235
+ vector[tv.QTY_TRANSACTION] = transaction.qty
236
+ // QTY_SHELF_STOCK is NOT set - picklists are subtracted separately via QTY_PICKLIST
237
+ vector[tv.QTY_CONSIGNMENT] = transaction.qty
238
+ vector[tv.AMOUNT_CONSIGNMENT] = round2(transaction.sellprice * transaction.qty)
239
+ vector[tv.COSTPRICE_CONSIGNMENT] = round2(transaction.buyprice * transaction.qty)
240
+ return vector
241
+ }
242
+
229
243
  if (transaction.type == transactionTypeE.RETURN_CUSTOMER) {
230
244
  const vector = new Float64Array(tv.COSTPRICE_B2B_RETURN + 1)
231
245
  vector[tv.QTY_TRANSACTION] = transaction.qty
@@ -362,6 +362,32 @@ describe('#Transactions', () => {
362
362
  })
363
363
  })
364
364
 
365
+ it('should return correct transaction for a type 95 (=consignment) transaction', () => {
366
+ const transaction = normalizeTransaction(
367
+ buildTransaction({
368
+ type: '95',
369
+ ean: '1234567890128',
370
+ wh: '51',
371
+ time: 314159265,
372
+ qty: 123,
373
+ buyprice: 9.95,
374
+ sellprice: 19.95,
375
+ vat: 21,
376
+ docnr: '51-123',
377
+ })
378
+ )
379
+ expect(transaction).toEqual({
380
+ type: '95',
381
+ ean: '1234567890128',
382
+ wh: '51',
383
+ time: 314159265,
384
+ docnr: '51-123',
385
+ // Type 95 (CONSIGNMENT) does NOT set QTY_SHELF_STOCK or AMOUNT_SHELF_STOCK
386
+ // Consignment reduce shelfStock, which is handled by subtracting QTY_CONSIGNMENT in postAgg
387
+ vector: [123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 123 * 19.95, 123 * 9.95],
388
+ })
389
+ })
390
+
365
391
  it('should return correct transaction for a type 6 (=b2b return to customer) transaction', () => {
366
392
  const transaction = normalizeTransaction(
367
393
  buildTransaction({