Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 7x 2x 1x 1x 1x 1x 1x 7x 2x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 7x 7x | import inventorySheetDao from '../../database/dao/inventorySheet'; import { t } from '../../helpers/i18n'; import { models } from '../../../config/database'; import { mountWhereBasedFilter } from '../../helpers/reports/sequelize'; function inventoryStatus(status, appLanguage) { switch (status) { case 1: return t('BEE470' /* Pendente */, undefined, appLanguage); case 2: return t('BEE2115' /* Em Contagem */, undefined, appLanguage); case 3: return t('BEE2116' /* Contagem Finalizada */, undefined, appLanguage); case 4: return t('BEE2119' /* Aprovado */, undefined, appLanguage); case 5: return t('BEE2118' /* Atualizado */, undefined, appLanguage); default: return status; } } function inventorySheetStatus(status, appLanguage) { switch (status) { case 1: return t('BEE470' /* Pendente */, undefined, appLanguage); case 2: return t('BEE2115' /* Em Contagem */, undefined, appLanguage); case 3: return t('BEE2116' /* Contagem Finalizada */, undefined, appLanguage); case 4: return t('BEE2117' /* Atualizada */, undefined, appLanguage); default: return status; } } export default async function generateData( filters, headers = [], rows = [], opts = {}, appLanguage = 'ptBr' ) { const where = mountWhereBasedFilter(filters); headers.push(String(t('BEE145' /* Filial */, undefined, appLanguage))); headers.push(String(t('BEE1516' /* Agrupador */, undefined, appLanguage))); headers.push( String(t('BEE2149' /* Situação Inventário */, undefined, appLanguage)) ); headers.push(String(t('BEE2106' /* Ficha */, undefined, appLanguage))); headers.push(String(t('BEE267' /* Endereço */, undefined, appLanguage))); headers.push( String(t('BEE1999' /* Código Produto */, undefined, appLanguage)) ); headers.push(String(t('BEE1998' /* Nome Produto */, undefined, appLanguage))); headers.push(String(t('BEE428' /* Lote */))); headers.push(String(t('BEE515' /* Saldo */, undefined, appLanguage))); headers.push(String(t('BEE4155' /* 1ª Contagem */, undefined, appLanguage))); headers.push(String(t('BEE4156' /* 2ª Contagem */, undefined, appLanguage))); headers.push(String(t('BEE4157' /* 3ª Contagem */, undefined, appLanguage))); headers.push( String(t('BEE2150' /* Situação Ficha */, undefined, appLanguage)) ); const dados = await inventorySheetDao.findInventoriesSheet(where, { attributes: [ 'branchCode', 'addressCode', 'productCode', 'lotNumber', 'balanceQuantity', 'status', 'firstCountQuantity', 'secondCountQuantity', 'thirdCountQuantity', 'sheetNumber', ], include: [ { required: true, model: models.Inventory, as: 'inventory', attributes: ['grouperCode', 'status'], }, { required: false, model: models.Product, as: 'product', attributes: ['name'], }, ], ...opts, }); for (let index = 0; index < dados.length; index++) { const element = dados[index]; rows.push([ element.branchCode, element.inventory.grouperCode, inventoryStatus(element.inventory.status), element.sheetNumber, element.addressCode, element.productCode ? element.productCode : '', element.product && element.product.name ? element.product.name : '', element.lotNumber ? element.lotNumber : '', element.balanceQuantity ? parseInt(element.balanceQuantity, 10) : '', element.firstCountQuantity ? element.firstCountQuantity : '', element.secondCountQuantity ? element.secondCountQuantity : '', element.thirdCountQuantity ? element.thirdCountQuantity : '', inventorySheetStatus(element.status), ]); } } |