positions.js 2.5 KB

123456789101112131415161718192021222324252627282930313233
  1. const { Text, Integer, DateTime, Decimal, Checkbox, Uuid, Relationship } = require('@keystonejs/fields');
  2. const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
  3. module.exports = {
  4. fields: {
  5. id: { type: Uuid, many: false, isRequired: true, label: 'positions' },
  6. dtype: { type: Text, isRequired: true, label: 'dtype' },
  7. pitype: { type: Integer, label: 'pitype' },
  8. pdate: { type: DateTime, label: 'pdate' },
  9. price_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena netto' },
  10. price_brutto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena brutto' },
  11. value_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc netto' },
  12. value_vat: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc VAT' },
  13. price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena zakupu' },
  14. currency_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Kurs waluty' },
  15. discount: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Upust' },
  16. discount_doc: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'discount_doc' },
  17. docdiscount: { type: Decimal, knexOptions: { precision: 5, scale: 1 }, label: 'docdiscount' },
  18. ord: { type: Integer, label: 'ord' },
  19. quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilosc' },
  20. kor: { type: Checkbox, isRequired: true, label: 'kor' },
  21. vat_id: { type: Relationship, ref: 'vat', many: false, label: 'VAT' },
  22. documents_id: { type: Relationship, ref: 'documents', many: false, label: 'documents' },
  23. items_id: { type: Relationship, ref: 'items', many: false, isRequired: true, label: 'Egzemplarz' },
  24. shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
  25. fifo: { type: Checkbox, label: 'fifo' },
  26. fifogen: { type: Checkbox, label: 'fifogen' },
  27. deliveryitems_id: { type: Relationship, ref: 'deliveryitems', many: false, label: 'deliveryitems' },
  28. fifoposkor_id: { type: Relationship, ref: 'fifopos', many: false, label: 'fifoposkor' }, // todo: spr foreignkey, nie wiadomo czy o to chodzilo
  29. custom_name: { type: Text, label: 'custom_name' },
  30. custom_desc: { type: Text, label: 'custom_desc' },
  31. }, label: 'Position'//, plural: 'Positionss'
  32. };