Ventes
TEST
{
  "__inputs": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.2.5"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 15328,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "custom": {
            "align": "auto",
            "displayMode": "lcd-gauge"
          },
          "mappings": [],
          "max": 0,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 6,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT sum(I.inv_subtotal) AS \"Ventes\"  FROM invoicing I\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and I.inv_date >= (SELECT orc_budg_begin_dt from order_config)\n\n\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT sum(clb_est_budg1) AS \"Budget\" FROM client_budget\nWHERE cli_id = (SELECT cli_id FROM client WHERE cli_no = 'KEBOIS')\n--Mettre numéro du client",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Objectif annuel ($)",
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byFrameRefID",
              "options": "A"
            },
            "configRefId": "B",
            "mappings": [
              {
                "fieldName": "Budget",
                "handlerKey": "max",
                "reducerId": "first"
              }
            ]
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "custom": {
            "align": "auto",
            "displayMode": "lcd-gauge"
          },
          "mappings": [],
          "max": 0,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 24,
        "x": 0,
        "y": 3
      },
      "id": 7,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT sum(I.inv_subtotal) AS \"Ventes\"  FROM invoicing I\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and EXTRACT (month FROM I.inv_date) = EXTRACT (month FROM current_date) AND EXTRACT (year FROM I.inv_date) = EXTRACT (year FROM current_date)\n\n\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT sum(clb_est_budg1) AS \"Budget\" FROM client_budget\nWHERE cli_id = (SELECT cli_id FROM client WHERE cli_no = 'KEBOIS') AND clb_period_no = EXTRACT (month FROM current_date)\n--Mettre numéro du client",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Objectif mensuel ($)",
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byFrameRefID",
              "options": "A"
            },
            "configRefId": "B",
            "mappings": [
              {
                "fieldName": "Budget",
                "handlerKey": "max",
                "reducerId": "first"
              }
            ]
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto"
          },
          "decimals": 2,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 9,
        "y": 6
      },
      "id": 11,
      "options": {
        "showHeader": false
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT sum(a.\"Budget\") AS \"Budget\", sum(a.\"Ventes\") As \"Ventes\" FROM\r\n(\r\nSELECT sum(clb_est_budg1) AS \"Budget\", 0 AS \"Ventes\" FROM client_budget\r\nWHERE cli_id = (SELECT cli_id FROM client WHERE cli_no = 'KEBOIS')\r\nUNION\r\nSELECT 0 AS \"Budget\", sum(I.inv_subtotal) AS \"Ventes\"  FROM invoicing I\r\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and I.inv_date >= (SELECT orc_budg_begin_dt from order_config)\r\n\r\n--Mettre numéro du client\r\n) a",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Objectif annuel (%)",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "Ventes",
              "operator": "/",
              "reducer": "sum",
              "right": "Budget"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": true
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto"
          },
          "decimals": 2,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 12,
        "y": 6
      },
      "id": 12,
      "options": {
        "showHeader": false
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT sum(a.\"Budget\") AS \"Budget\", sum(a.\"Ventes\") As \"Ventes\" FROM\r\n(\r\nSELECT sum(clb_est_budg1) AS \"Budget\", 0 AS \"Ventes\" FROM client_budget\r\nWHERE cli_id = (SELECT cli_id FROM client WHERE cli_no = 'KEBOIS') AND clb_period_no = EXTRACT (month FROM current_date)\r\nUNION\r\nSELECT 0 AS \"Budget\", sum(I.inv_subtotal) AS \"Ventes\"  FROM invoicing I\r\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and EXTRACT (month FROM I.inv_date) = EXTRACT (month FROM current_date) AND EXTRACT (year FROM I.inv_date) = EXTRACT (year FROM current_date)\r\n--Mettre numéro du client\r\n) a",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Objectif mensuel (%)",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "Ventes",
              "operator": "/",
              "reducer": "sum",
              "right": "Budget"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": true
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "fill": 2,
      "fillGradient": 6,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 8
      },
      "hiddenSeries": false,
      "id": 14,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "hideEmpty": false,
        "hideZero": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": false,
        "total": true,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "nullPointMode": "null as zero",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "8.2.5",
      "pointradius": 4,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT I.inv_date AS \"Jour\", sum(I.inv_subtotal) AS \"Ventes\" FROM invoicing I\r\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and EXTRACT (month FROM I.inv_date) = EXTRACT (month FROM current_date) AND EXTRACT (year FROM I.inv_date) = EXTRACT (year FROM current_date)\r\nGROUP BY I.inv_date\r\nORDER BY I.inv_date",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Ventes quotidiennes (mois courant)",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Jour": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Ventes": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "transparent": true,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1136",
          "format": "currencyUSD",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:1137",
          "decimals": null,
          "format": "currencyUSD",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "fill": 2,
      "fillGradient": 6,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 16
      },
      "hiddenSeries": false,
      "id": 15,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "hideEmpty": false,
        "hideZero": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": false,
        "total": true,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "nullPointMode": "null as zero",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "8.2.5",
      "pointradius": 4,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT OH.ord_date AS \"Jour\", count(ord_no) AS \"Ventes\" FROM order_header OH\r\nWHERE OH.ord_status <> 'C' AND EXTRACT (month FROM OH.ord_date) = EXTRACT (month FROM current_date) AND EXTRACT (year FROM OH.ord_date) = EXTRACT (year FROM current_date)\r\nGROUP BY OH.ord_date\r\nORDER BY OH.ord_date",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Nouvelles commandes quotidiennes (mois courant)",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Jour": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Ventes": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "transparent": true,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1136",
          "format": "currencyUSD",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:1137",
          "decimals": null,
          "format": "currencyUSD",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 16,
        "w": 8,
        "x": 0,
        "y": 24
      },
      "id": 4,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Ventes (sum)"
          }
        ]
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT cli_name1 AS \"Client\", inv_subtotal AS \"Ventes\"  FROM invoicing I\r\nINNER JOIN client C ON C.cli_id = I.cli_id\r\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and I.inv_date >= (SELECT orc_budg_begin_dt from order_config)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Ventes par client",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Ventes (sum)": false
            },
            "indexByName": {
              "Client": 0,
              "Ventes (sum)": 1
            },
            "renameByName": {
              "Ventes (sum)": "Ventes"
            }
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Client": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Ventes": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "cli_name1": {
                "aggregations": [],
                "operation": "groupby"
              },
              "inv_subtotal": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "transparent": true,
      "type": "table"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 16,
        "w": 9,
        "x": 8,
        "y": 24
      },
      "id": 2,
      "options": {
        "displayLabels": [],
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "values": [
            "value"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "/^inv_subtotal \\(sum\\)$/",
          "limit": 50,
          "values": true
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT ter_nom, inv_subtotal  FROM invoicing I\r\nINNER JOIN territory T ON T.ter_id = I.ter_id\r\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and I.inv_date >= (SELECT orc_budg_begin_dt from order_config)\r\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Ventes par territoire",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "inv_subtotal": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "ter_id": {
                "aggregations": [],
                "operation": "groupby"
              },
              "ter_nom": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        }
      ],
      "transparent": true,
      "type": "piechart"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 21,
        "w": 6,
        "x": 17,
        "y": 24
      },
      "id": 16,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Ventes (sum)"
          }
        ]
      },
      "pluginVersion": "8.2.5",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT S.sal_name AS \"Vendeur\", inv_subtotal AS \"Ventes\"  FROM invoicing I\r\nINNER JOIN salesman S ON S.sal_id = I.sal_id\r\nWHERE I.inv_status = 'F' AND I.inv_no <> 0 and I.inv_date >= (SELECT orc_budg_begin_dt from order_config)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Ventes par vendeur",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Client": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Vendeur": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Ventes": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "cli_name1": {
                "aggregations": [],
                "operation": "groupby"
              },
              "inv_subtotal": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "transparent": true,
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 32,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "Ventes",
  "uid": "TjRLdxtnz",
  "version": 10,
  "description": "TEST"
}