KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Global variables are not passing from one datatable to another data table in drill down #2990

Open Lalitha opened this topic on on Feb 17, 2023 - 1 comments

Lalitha commented on Feb 17, 2023

DrillDown::create(array(

"name"=>"saleDrillDown",
"title"=>"Analyze Subject and Series Wise Planning Vs Achievement",
"showTitle"=>false,
"levels"=>array(
    array(
        "title"=>"All Subject",
        "content"=>function($params )
        {
            DataTables::create(array(
                "name" => "reportTable",
                /*"dataStore" => isset($this->params["subject"]) ? $this->dataStore("Strategy_list_Subject") : [],*/
                //"dataStore" => isset($this->params["code"]) ? $this->dataStore("sales") : [],

                "dataSource"=>(
                    $this->src("automaker")->query("
                    SELECT UPPER (SUBJECTNM) SUBJECTNM " . $GLOBALS['qryz'] . ",SUM(isnull(SALEVOL,0)) SALEVOL,
                    SUM(isnull(SALEVAL,0)) SALEVAL,SUM(isnull(PLNVOL,0)) PLNVOL,SUM(isnull(PLNVAL,0)) PLNVAL,
                    SUM(isnull(SALEVOLC,0)) SALEVOLC,SUM(isnull(SALEVALC,0)) SALEVALC,SUM(isnull(PDBVOL,0)) PDBVOL,
                    SUM(isnull(PDBVAL,0)) PDBVAL
                     FROM  DH_CRMWISEPLANACTUALINFO
                    where Not SUBJECTNM is NULL  " . $GLOBALS['qryc'] . "
                    group by SUBJECTNM  " . $GLOBALS['qrygz'] ."  " . $GLOBALS['qryg'] . " ORDER BY UPPER (SUBJECTNM)
                    ")
                ),
                "plugins" => ["FixedHeader"],
                "options" => array(
                    "colReorder" => true,
                    "scrollY" => "500px",
                    "scrollX" => true,
                    "scrollCollapse" => true,
                    "fixedHeader"=>true,
                    // "fixedColumns" => array(
                    //     "leftColumns" => 1
                    // ),
                    "select" => true,
                    "ordering" => false,
                ),
                "responsive"=>true,
                "showFooter"=>true,
                "title"=>"Subject Wise Planning Vs Acheivement",
                "columns"=>array(
                    "SUBJECTNM"=>array(
                        "type"=>"string",
                        "label"=>"SUBJECT NAME",
                        "footerText"=>"<b>Total:</b>",
                    ),
                    "ZONENM"=>array(
                        "type"=>"string",
                        "label"=>"ZONE NAME",
                       "visible"=>false,

                    ),
                   /* "zn"=>array(
                        "type"=>"string",
                        "label"=>"ZONE",
                           ),
                           "ln"=>array(
                            "type"=>"string",
                            "label"=>"LOC",
                               ),
                    "BOARD"=>array(
                        "type"=>"string",
                        "label"=>"BOARD",
                           ),*/
                    "SALEVOL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVAL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVOLC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVALC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                ),
                "cssClass"=>array(
                    "table"=>"table table-hover",
                    "th"=>"cssHeader",
                    "tr"=>"cssItem",
                    "tf"=>"cssIFooter",
                    "td"=>function($row,$colName)
                    {
                        if ($colName=="SUBJECTNM")
                        {
                            return "cssTd";
                        }
                        else if ($colName=="SALEVOL" or $colName=="SALEVAL" or $colName=="SALEVOLC" or $colName=="SALEVALC")
                        {
                            return "cssTdw";
                        }
                        else
                        {
                            return "text-center";
                        }
                    },
                ),
                // "clientEvents"=>array(
                //     "rowClick"=>"function(params){
                //         saleDrillDown.next({name:params.rowData[0]});
                //     }",
                "clientEvents"=>array(
                    "select"=>"function(e,dt,type,indexes){
                      
                        var data = dt.rows(indexes).data()[0];
                       console.log(data);
                                                
                        var dname=data[0];
                       
                        console.log(dname);
                        var dzone=data[1];
                        
                        console.log(dzone);
                        
                        saleDrillDown.next({subjectnm:dname,zonenm:dzone});
                        
                     }",
                )
            ));
        }
    ),
    
    array(
       
       "title"=>function($params )
        {
        
            return "Subject - ".$params["subjectnm"];
          
        },
        "content"=>function($params )
        {
                          DataTables::create(array(
                "name" => "reportTable1",                    
                "dataSource"=>(
                    $this->src("automaker")
                    ->query("
                    SELECT UPPER (SERIESNM) SERIESNM " . $GLOBALS['qryz'] . ",SUM(isnull(SALEVOL,0)) SALEVOL,
                    SUM(isnull(SALEVAL,0)) SALEVAL,SUM(isnull(PLNVOL,0)) PLNVOL,SUM(isnull(PLNVAL,0)) PLNVAL,
                    SUM(isnull(SALEVOLC,0)) SALEVOLC,SUM(isnull(SALEVALC,0)) SALEVALC,SUM(isnull(PDBVOL,0)) PDBVOL,SUM(isnull(PDBVAL,0)) PDBVAL FROM  DH_CRMWISEPLANACTUALINFO
                    where  SUBJECTNM=:subjectnm  " . $GLOBALS['qryc'] . " group by SERIESNM " . $GLOBALS['qrygz'] ."  " . $GLOBALS['qryg'] . " ORDER BY UPPER (SERIESNM)
                      ")       
                      ->params(array(
                        ":subjectnm"=>$params["subjectnm"],
                        ":zonenm"=>$params["zonenm"],
                       ))              
                ),
                "plugins" => ["FixedHeader"],
                "options" => array(
                    "colReorder" => true,
                    "scrollY" => "500px",
                    "scrollX" => true,
                    "scrollCollapse" => true,
                    "fixedHeader"=>true,
                    // "fixedColumns" => array(
                    //     "leftColumns" => 1
                    // ),
                    "select" => true,
                    "ordering" => false,
                ),
                "responsive"=>true,
                "showFooter"=>true,
                "title"=>"District  Wise Net Volume Sale",
                "columns"=>array(
                    "SERIESNM"=>array(
                        "type"=>"string",
                        "label"=>"SERIES NAME",
                        "footerText"=>"<b>Total:</b>",
                    ),
                    "ZONENM"=>array(
                        "type"=>"string",
                        "label"=>"ZONE NAME",
                        "visible"=>false,

                    ),
                   /* "zn"=>array(
                        "type"=>"string",
                        "label"=>"ZONE",
                           ),
                           "ln"=>array(
                            "type"=>"string",
                            "label"=>"LOC",
                               ),
                    "BOARD"=>array(
                        "type"=>"string",
                        "label"=>"BOARD",
                           ),*/
                    "SALEVOL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVAL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVOLC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVALC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                ),
                "cssClass"=>array(
                    "table"=>"table table-hover",
                    "th"=>"cssHeader",
                    "tr"=>"cssItem",
                    "tf"=>"cssIFooter",
                    "td"=>function($row,$colName)
                    {
                        if ($colName=="SERIESNM")
                        {
                            return "cssTd";
                        }
                        else if ($colName=="SALEVOL" or $colName=="SALEVAL" or $colName=="SALEVOLC" or $colName=="SALEVALC")
                        {
                            return "cssTdw";
                        }
                        else
                        {
                            return "text-center";
                        }
                    },
                ),
                // "clientEvents"=>array(
                //     "rowClick"=>"function(params){
                //         saleDrillDown.next({distt:params.rowData[0]});
                //     }",
                "clientEvents"=>array(
                    "select"=>"function(e,dt,type,indexes){
                        var data = dt.rows(indexes).data()[0];
                        console.log(data);
                        var srnm=data[0];
                        console.log(srnm);
                        var dzone=data[1];
                        
                        console.log(dzone);
                      
                        saleDrillDown.next({seriesnm:srnm,zonenm:dzone});
                    }",
                )
            ));
        }
    ),
    array(
        "title"=>function($params )
        {
            return "Series - ".$params["seriesnm"];
        },
        "content"=>function($params )
        {
            DataTables::create(array(
                "name" => "reportTable2",
                "dataSource"=>(
                    $this->src("automaker")->query("
                    SELECT UPPER (NAME) NAME " . $GLOBALS['qryz'] . ",SUM(isnull(SALEVOL,0)) SALEVOL,
                    SUM(isnull(SALEVAL,0)) SALEVAL,SUM(isnull(PLNVOL,0)) PLNVOL,SUM(isnull(PLNVAL,0)) PLNVAL,
                    SUM(isnull(SALEVOLC,0)) SALEVOLC,SUM(isnull(SALEVALC,0)) SALEVALC,SUM(isnull(PDBVOL,0)) PDBVOL,SUM(isnull(PDBVAL,0)) PDBVAL FROM  DH_CRMWISEPLANACTUALINFO
                    where  EXECCODE IN (" . $_SESSION['subordinates'] . ") and SUBJECTNM=:subjectnm and SERIESNM=:seriesnm  " . $GLOBALS['qryc'] . "  
                    group by NAME " . $GLOBALS['qrygz'] ."  " . $GLOBALS['qryg'] . " ORDER BY UPPER (NAME)
                    ")
                    ->params(array(
                        ":subjectnm"=>$params["subjectnm"],
                        ":zonenm"=>$params["zonenm"],
                        ":seriesnm"=>$params["seriesnm"],
                    ))
                ),
                "plugins" => ["FixedHeader"],
                "options" => array(
                    "colReorder" => true,
                    "scrollY" => "500px",
                    "scrollX" => true,
                    "scrollCollapse" => true,
                    "fixedHeader"=>true,
                    // "fixedColumns" => array(
                    //     "leftColumns" => 1
                    // ),
                    "select" => true,
                    "ordering" => false,
                ),
                "responsive"=>true,
                "showFooter"=>true,
                "title"=>"District  Wise Net Volume Sale",
                "columns"=>array(
                    "NAME"=>array(
                        "type"=>"string",
                        "label"=>"EXECUTIVE NAME",
                        "footerText"=>"<b>Total:</b>",
                    ),
                    "ZONENM"=>array(
                        "type"=>"string",
                        "label"=>"ZONE NAME",
                        "visible"=>false,

                    ),
                  /*  "zn"=>array(
                        "type"=>"string",
                        "label"=>"ZONE",
                           ),
                           "ln"=>array(
                            "type"=>"string",
                            "label"=>"LOC",
                               ),
                    "BOARD"=>array(
                        "type"=>"string",
                        "label"=>"BOARD",
                           ),*/
                    "SALEVOL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVAL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVOLC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVALC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                ),
                "cssClass"=>array(
                    "table"=>"table table-hover",
                    "th"=>"cssHeader",
                    "tr"=>"cssItem",
                    "tf"=>"cssIFooter",
                    "td"=>function($row,$colName)
                    {
                        if ($colName=="NAME")
                        {
                            return "cssTd";
                        }
                        else if ($colName=="SALEVOL" or $colName=="SALEVAL" or $colName=="SALEVOLC" or $colName=="SALEVALC")
                        {
                            return "cssTdw";
                        }
                        else
                        {
                            return "text-center";
                        }
                    },
                ),
                // "clientEvents"=>array(
                //     "rowClick"=>"function(params){
                //         saleDrillDown.next({distt:params.rowData[0]});
                //     }",
                "clientEvents"=>array(
                    "select"=>"function(e,dt,type,indexes){
                        var data = dt.rows(indexes).data()[0];
                        console.log(data);
                        var ename=data[0];
                        console.log(ename);
                        var dzone=data[1];
                        
                        console.log(dzone);
            
                        saleDrillDown.next({name:ename,zonenm:dzone});
                    }",
                )
            ));
        }
    ),
    array(
        "title"=>function($params )
        {
            return "Executive - ".$params["name"];
        },
        "content"=>function($params )
        {
            DataTables::create(array(
                "name" => "reportTable3",
                "dataSource"=>(
                    $this->src("automaker")->query("
                    SELECT sccode " . $GLOBALS['qryz'] . ",UPPER (SCNAME) SCNAME,SUM(isnull(SALEVOL,0)) SALEVOL,
                    SUM(isnull(SALEVAL,0)) SALEVAL,SUM(isnull(PLNVOL,0)) PLNVOL,SUM(isnull(PLNVAL,0)) PLNVAL,
                    SUM(isnull(SALEVOLC,0)) SALEVOLC,SUM(isnull(SALEVALC,0)) SALEVALC,SUM(isnull(PDBVOL,0)) PDBVOL,SUM(isnull(PDBVAL,0)) PDBVAL FROM  DH_CRMWISEPLANACTUALINFO
                    where EXECCODE IN (" . $_SESSION['subordinates'] . ") and SUBJECTNM=:subjectnm and SERIESNM=:seriesnm and name=:name
                     " . $GLOBALS['qryc'] . " group by sccode,SCNAME " . $GLOBALS['qrygz'] ."  " . $GLOBALS['qryg'] . " ORDER BY UPPER (SCNAME)
                    ")
                    ->params(array(
                        ":subjectnm"=>$params["subjectnm"],
                        ":zonenm"=>$params["zonenm"],
                        ":seriesnm"=>$params["seriesnm"],
                        ":name"=>$params["name"],
                    ))
                ),
                "plugins" => ["FixedHeader"],
                "options" => array(
                    "colReorder" => true,
                    "scrollY" => "500px",
                    "scrollX" => true,
                    "scrollCollapse" => true,
                    "fixedHeader"=>true,
                    // "fixedColumns" => array(
                    //     "leftColumns" => 1
                    // ),
                    "select" => true,
                    "ordering" => false,
                ),
                "responsive"=>true,
                "showFooter"=>true,
                "columns"=>array(
                    "SCNAME"=>array(
                        "type"=>"string",
                        "label"=>"SCHOOL NAME",
                        "footerText"=>"<b>Total:</b>",
                        "formatValue"=>function($value,$row)
                        {
                           /*  return "<a href='../crm/CRMInfo.main.php?sccode=" . $row["sccode"] ."' target='_blank'>" . $value . "</a>"; */
                           echo("<script>console.log('PHP:" . $encodedVar = base64_encode($row["sccode"]) . "');</script>");
                            echo("<script>console.log('PHP: " . $row["sccode"] . "');</script>");
                            echo("<script>console.log('PHP: " . substr($row["sccode"],2,7) . "');</script>");
                            if ((substr($row["sccode"],2,7) == '0000000') && ($row["sccode"] != 'UNMAPPED'))
                            {
                                echo("<script>console.log('Self: " . substr($row["sccode"],2,7) . "');</script>");
                                return "<a href='../sales/CustInfoForUnmapSelfMain.main.php?cRmsCD=" . base64_encode($row["sccode"]) ."&cRmLoc=" . base64_encode($row["LOC"]) ."&ExeCd=" . base64_encode($row["execcode"]) ."&dIStt=" . base64_encode($row["distt"]) ."&sCNm=" . base64_encode($row["scname"]) ."&TbNm=" . base64_encode('VOLSALE_'. substr($_GET['yR'],2,2).substr($_GET['yR'],7,2)) . "&cOlNm=" . base64_encode('invvolfortheday') ."' target='_blank'>" . $value . "</a>";
                            }else if (($row["sccode"] == 'UNMAPPED') && (substr($row["sccode"],2,7) != '0000000'))
                            {
                                echo("<script>console.log('UNMAPPED: " . $row["sccode"] . "');</script>");
                                return "<a href='../sales/CustInfoForUnmapSelfMain.main.php?cRmsCD=" . base64_encode($row["sccode"]) ."&cRmLoc=" . base64_encode($row["LOC"]) ."&ExeCd=" . base64_encode($row["execcode"]) ."&dIStt=" . base64_encode($row["distt"]) ."&sCNm=" . base64_encode($row["scname"]) ."&TbNm=" . base64_encode('VOLSALE_'. substr($_GET['yR'],2,2).substr($_GET['yR'],7,2)) . "&cOlNm=" . base64_encode('invvolfortheday') ."' target='_blank'>" . $value . "</a>";
                            }else if ((substr($row["sccode"],2,7) != '0000000') || ($row["sccode"] != 'UNMAPPED'))
                            {
                                echo("<script>console.log('NOT self Unmapped: " . $row["sccode"] . "');</script>");
                                return "<a href='../crm/CRMInfo.main.php?sccode=" . $row["sccode"] ."' target='_blank'>" . $value . "</a>";
                            }
                        }
                    ),
                    "ZONENM"=>array(
                        "type"=>"string",
                        "label"=>"ZONE NAME",
                        "visible"=>false,

                    ),
                   /* "zn"=>array(
                        "type"=>"string",
                        "label"=>"ZONE",
                           ),
                           "ln"=>array(
                            "type"=>"string",
                            "label"=>"LOC",
                               ),
                    "BOARD"=>array(
                        "type"=>"string",
                        "label"=>"BOARD",
                           ),*/
                    "SALEVOL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVAL"=>array(
                        "type"=>"number",
                        "label"=>"2021-22 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PLNVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Planned Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVOLC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Volume Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "SALEVALC"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 Net Value Sale",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVOL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Volume",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                    "PDBVAL"=>array(
                        "type"=>"number",
                        "label"=>"2022-23 PDB Value",
                        "cssStyle"=>"text-align:right;background-color: #FAFAFA",
                        "footer"=>"sum",
                        "footerText"=>"<b>@value</b>",
                        "formatValue"=>function($value,$row, $cKey)
                        {
                            return preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/i", "$1,", $value );

                        },
                    ),
                ),
                "cssClass"=>array(
                    "table"=>"table table-hover",
                    "th"=>"cssHeader",
                    "tr"=>"cssItem",
                    "tf"=>"cssIFooter",
                    "td"=>function($row,$colName)
                    {
                        if ($colName=="SCNAME")
                        {
                            return "cssTd";
                        }
                        else if ($colName=="SCHOOLMAPPED" or $colName=="SCHOOLPLANNED" or $colName=="TOTUSERSCH" or $colName=="SCHOOLVISITSMAPPED" or $colName=="SCHOOLVISITSUNMAPPED" or
                        $colName=="SCHOOLPDBMAPPED" or $colName=="SCHOOLPDBUNMAPPED" or $colName=="OTHERSPDB" or $colName=="PDBVOL" or $colName=="PLANVOL" or $colName=="PLNADOPT" or $colName=="STKRTNDAYINV" or $colName=="OSTKRTNDAYINV")
                        {
                            return "cssTdw";
                        }
                        else
                        {
                            return "text-center";
                        }
                    },
                ),
            ));
        }
    ),

   
),

));

Sebastian Morales commented on Feb 21, 2023

Would you pls describe the problem in more details, for example which variables/parameters are not passed, what should their values be, include screenshots of the problem if possible? Tks,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None