Primeiro commit do projeto
davinTI/app-dono-modulos/pipeline/head There was a failure building this commit
davinTI/app-dono-modulos/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -105,4 +105,13 @@ order by grouping(canalapp) desc, grouping(nomeempresaapp) desc`,
|
||||
};
|
||||
},
|
||||
},
|
||||
}).withSchedules({
|
||||
C5: [
|
||||
{
|
||||
command: 'exec procedure',
|
||||
cron: 'expressao cron',
|
||||
name: 'Teste identificador da query',
|
||||
timeout_seconds: 30
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
import { createModuleFactory } from "@davinti/jeff";
|
||||
|
||||
const moduleFactory = createModuleFactory(["C5BIG"]);
|
||||
|
||||
export default moduleFactory
|
||||
.createModule({
|
||||
id: "flash-de-perdas",
|
||||
description: "Flash de Perdas",
|
||||
label: "Flash de Perdas",
|
||||
icon: "bar-chart",
|
||||
queries: {
|
||||
flash: {
|
||||
name: "Flash de Perdas",
|
||||
display: {
|
||||
type: "flash",
|
||||
settings: {
|
||||
group_column: "canalapp",
|
||||
total_indicator_column: "is_total",
|
||||
null_label_key: "Geral",
|
||||
},
|
||||
header: {
|
||||
title_column: "canalapp",
|
||||
value_column: "venda_dia",
|
||||
value_format: "currency",
|
||||
},
|
||||
rows: [
|
||||
{
|
||||
label: "Meta Mês",
|
||||
column: "meta_mes",
|
||||
format: "currency_short",
|
||||
},
|
||||
{
|
||||
label: "VDA",
|
||||
column: "vda",
|
||||
format: "currency_short",
|
||||
},
|
||||
{
|
||||
label: "DMA",
|
||||
column: "dma",
|
||||
format: "currency_short",
|
||||
},
|
||||
{
|
||||
label: "Meta Dia",
|
||||
column: "meta_dia",
|
||||
format: "currency_short",
|
||||
},
|
||||
{
|
||||
label: "Meta Margem Dia",
|
||||
column: "meta_margem_dia",
|
||||
format: "percentage",
|
||||
},
|
||||
{
|
||||
label: "Qtd Clientes",
|
||||
column: "qtd_clientes",
|
||||
format: "integer",
|
||||
},
|
||||
{
|
||||
label: "Ticket Médio",
|
||||
column: "ticket_medio",
|
||||
format: "currency",
|
||||
},
|
||||
{
|
||||
label: "Margem",
|
||||
column: "margem",
|
||||
format: "percentage",
|
||||
accent: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
params: ["data_venda"],
|
||||
},
|
||||
},
|
||||
entrypoint: "flash",
|
||||
})
|
||||
.withImplementations({
|
||||
C5BIG: {
|
||||
flash: (args) => {
|
||||
return {
|
||||
sql: /*sql*/ `
|
||||
select
|
||||
tes.canalapp,
|
||||
tes.nomeempresaapp,
|
||||
grouping(tes.canalapp) is_total,
|
||||
sum(tvf.vlrvendadia) venda_dia,
|
||||
sum(tvf.vlrmetames) meta_mes,
|
||||
sum(tvf.vlrvendaacumulada) vda,
|
||||
sum(tvf.vlrvendaacumulada - tvf.vlrmetaaculumada) dma,
|
||||
sum(tvf.vlrmetadia) meta_dia,
|
||||
round(avg(tvf.vlrmetamargemdiaperc), 2) meta_margem_dia,
|
||||
sum(tvf.qtdclientes) qtd_clientes,
|
||||
round(sum(tvf.vlrvendadia) / nullif(sum(tvf.qtdclientes), 0), 2) as ticket_medio,
|
||||
round((sum(tvf.vlrlucro) / nullif(sum(tvf.vlrvendadia), 0)) * 100, 2) as margem
|
||||
from mboard.tb_venda_flash tvf
|
||||
inner join mboard.tb_empresa_segmento tes
|
||||
on tes.nroempresa = tvf.nroempresa
|
||||
and tes.nrodivisao = tvf.nrodivisao
|
||||
and tes.nrosegmento = tvf.nrosegmento
|
||||
and tes.codcanal = tvf.codcanal
|
||||
where 1=1
|
||||
and tvf.vlrvendaacumulada > 0
|
||||
and tvf.dtavda = TO_DATE(${args.data_venda}, 'YYYY-MM-DD')
|
||||
and (tvf.nroempresa in (${args.ctx_user_companies_for_module}))
|
||||
group by rollup(canalapp, nomeempresaapp)
|
||||
order by grouping(canalapp) desc, grouping(nomeempresaapp) desc`,
|
||||
};
|
||||
},
|
||||
},
|
||||
}).withSchedules({
|
||||
C5BIG: [
|
||||
{
|
||||
command: 'exec procedure',
|
||||
cron: 'expressao cron',
|
||||
name: 'Teste identificador da query',
|
||||
timeout_seconds: 30
|
||||
}
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user