fleetfolio/aws_monthely_cost_detail_list.sql

              SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
              -- not including breadcrumbs from sqlpage_aide_navigation
              -- not including page title from sqlpage_aide_navigation
              

               SELECT 'title' AS component, (SELECT COALESCE(title, caption)
    FROM sqlpage_aide_navigation
   WHERE namespace = 'prime' AND path = 'fleetfolio/aws_monthely_cost_detail_list.sql/index.sql') as contents;
    ;
   --- Display breadcrumb
SELECT
   'breadcrumb' AS component;
 SELECT
   'Home' AS title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/'    AS link;
 SELECT
   'Fleetfolio' AS title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/fleetfolio/index.sql' AS link;  
 SELECT
   'Boundary' AS title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/fleetfolio/boundary.sql' AS link; 

 SELECT
   'AWS Trust Boundary' AS title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/fleetfolio/aws_trust_boundary_list.sql' AS link; 

 SELECT
   'AWS Monthely Cost Summary' AS title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/fleetfolio/aws_monthely_cost_detail_list.sql' AS link; 


 --- Dsply Page Title
 SELECT
     'title'   as component,
     "AWS Monthely Cost Summary" contents;

    select
     'text'              as component,
     'View a consolidated summary of your AWS spending, broken down by account and month. Monitor trends, compare costs, and gain insights to optimize your cloud expenses.' as contents;


 SET total_rows = (SELECT COUNT(*) FROM list_aws_monthely_cost_detail );
SET limit = COALESCE($limit, 50);
SET offset = COALESCE($offset, 0);
SET total_pages = ($total_rows + $limit - 1) / $limit;
SET current_page = ($offset / $limit) + 1; 
SELECT 'table' AS component,
       TRUE as sort,
       TRUE as search;
   SELECT 
   account,
   amortized_cost_amount AS "Amortized Cost",
   blended_cost_amount AS "Blended Cost",
   net_amortized_cost_amount AS "Net Amortized AWS Cost",
   net_unblended_cost_amount AS "Net Unblended AWS Cost", 
   unblended_cost_amount AS "Unblended AWS Cost",
   datetime(substr(period_start, 1, 19)) as "Period Start"
   FROM list_aws_monthely_cost_detail;
    SELECT 'text' AS component,
    (SELECT CASE WHEN $current_page > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) ||     ')' ELSE '' END) || ' ' ||
    '(Page ' || $current_page || ' of ' || $total_pages || ") " ||
    (SELECT CASE WHEN $current_page < $total_pages THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) ||     ')' ELSE '' END)
    AS contents_md 
;
            

;