AutomationFlowsGeneral › Daily Revenue & Remaining Report

Daily Revenue & Remaining Report

Daily Revenue & Remaining Report. Uses mssql, emailSend. Event-driven trigger; 5 nodes.

Event trigger★★★★☆ complexity5 nodesMssqlEmail Send
General Trigger: Event Nodes: 5 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Daily Revenue & Remaining Report",
  "nodes": [
    {
      "parameters": {},
      "id": "manual-trigger",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        260,
        260
      ]
    },
    {
      "parameters": {
        "host": "DESKTOP-0RJ1A8T\\NADINE",
        "database": "Sougui_DWH",
        "user": "",
        "password": "",
        "ssl": false,
        "queries": [
          {
            "query": "SELECT CAST(SUM(CAST(reste_du AS FLOAT)) AS DECIMAL(15,2)) as total_reste FROM Fact_Achat WHERE CAST(CONVERT(DATE, GETDATE()) AS DATE) = CAST(CONVERT(DATE, GETDATE()) AS DATE)"
          }
        ]
      },
      "id": "sql-reste-du",
      "name": "SQL - Get Reste_du",
      "type": "n8n-nodes-base.mssql",
      "typeVersion": 2.0,
      "position": [
        450,
        250
      ]
    },
    {
      "parameters": {
        "host": "DESKTOP-0RJ1A8T\\NADINE",
        "database": "Sougui_DWH",
        "user": "",
        "password": "",
        "ssl": false,
        "queries": [
          {
            "query": "SELECT CAST(SUM(CAST(Total_TTC AS FLOAT)) AS DECIMAL(15,2)) as ca_b2b FROM Fact_V_B2B UNION ALL SELECT CAST(SUM(CAST(Montant_total_de_la_commande AS FLOAT)) AS DECIMAL(15,2)) as ca_b2c FROM Fact_V_B2C"
          }
        ]
      },
      "id": "sql-ca",
      "name": "SQL - Get Chiffre Affaire",
      "type": "n8n-nodes-base.mssql",
      "typeVersion": 2.0,
      "position": [
        450,
        400
      ]
    },
    {
      "parameters": {
        "functionCode": "const reste = $input.item.json.total_reste || 0;\\nconst ca_b2b = $input.all()[1].json.ca_b2b || 0;\\nconst ca_b2c = $input.all()[1].json.ca_b2c || 0;\\nconst total_ca = ca_b2b + ca_b2c;\\nconst today = new Date().toLocaleDateString('fr-FR');\\n\\nreturn {\\n  date: today,\\n  reste_du: reste.toLocaleString('fr-FR', {minimumFractionDigits: 2, maximumFractionDigits: 2}),\\n  ca_total: total_ca.toLocaleString('fr-FR', {minimumFractionDigits: 2, maximumFractionDigits: 2}),\\n  ca_b2b: ca_b2b.toLocaleString('fr-FR', {minimumFractionDigits: 2, maximumFractionDigits: 2}),\\n  ca_b2c: ca_b2c.toLocaleString('fr-FR', {minimumFractionDigits: 2, maximumFractionDigits: 2})\\n}"
      },
      "id": "format-data",
      "name": "Format Data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2.0,
      "position": [
        650,
        325
      ]
    },
    {
      "parameters": {
        "fromEmail": "your-email@gmail.com",
        "toEmail": "nadinechiha50@gmail.com",
        "subject": "\ud83d\udcca Rapport Quotidien - Chiffre d'Affaire & Reste D\u00fb",
        "emailType": "html",
        "htmlEmail": "<html><body>Rapport quotidien - {{ $node[\"Format Data\"].json.date }}</body></html>"
      },
      "id": "send-email",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1.0,
      "position": [
        850,
        325
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "SQL - Get Reste_du",
            "type": "main",
            "index": 0
          },
          {
            "node": "SQL - Get Chiffre Affaire",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SQL - Get Reste_du": {
      "main": [
        [
          {
            "node": "Format Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SQL - Get Chiffre Affaire": {
      "main": [
        [
          {
            "node": "Format Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Data": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "versionId": "1"
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Daily Revenue & Remaining Report. Uses mssql, emailSend. Event-driven trigger; 5 nodes.

Source: https://github.com/nadinechiha1/nadinechiha_pi_ml2/blob/a516b0cd8485dacb9315c25045792249aab41792/n8n/main.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Todoist Weekly Review Template. Uses manualTrigger, httpRequest, scheduleTrigger, emailSend. Event-driven trigger; 6 nodes.

HTTP Request, Email Send
General

VivaMarket Error Handler. Uses errorTrigger, emailSend. Event-driven trigger; 2 nodes.

Error Trigger, Email Send
General

Spotify Sync Liked Songs to Playlist. Uses gotify, spotify, stopAndError. Event-driven trigger; 41 nodes.

Gotify, Spotify, Stop And Error
General

Spotify Sync Liked Songs to Playlist. Uses manualTrigger, scheduleTrigger, sort, gotify. Event-driven trigger; 40 nodes.

Gotify, Spotify
General

My workflow 2. Uses manualTrigger, xml, httpRequest, googleSheets. Event-driven trigger; 26 nodes.

XML, HTTP Request, Google Sheets