public function getStateOnDate($datestamp, $addCountryCode = false)
    {
        $result = [];
        $bind = [];
        $bind[QBldMax::BND_ON_DATE] = $datestamp;
        $query = $this->qbuildSnapOnDate->build();
        if ($addCountryCode) {
            /* define tables aliases */
            $as = self::AS_TBL_DWNL;
            $tbl = $this->resource->getTableName(ECustomer::ENTITY_NAME);
            $on = $as . '.' . ECustomer::A_CUSTOMER_REF . '='
                . QBldSnap::AS_DWNL_SNAP . '.' . Entity::A_CUSTOMER_REF;
            $cols = [
                self::A_COUNTRY => ECustomer::A_COUNTRY_CODE,
                self::A_MLM_ID => ECustomer::A_MLM_ID
            ];
            $query->joinLeft([$as => $tbl], $on, $cols);
        }
        $query->order(
            QBldSnap::AS_DWNL_SNAP . '.'
            . \Praxigento\Downline\Repo\Data\Snap::A_DEPTH
        );
        $rows = $this->conn->fetchAll($query, $bind);
        if (count($rows)) {
            foreach ($rows as $one) {
                $result[$one[\Praxigento\Downline\Repo\Query\Snap\OnDate\Builder::A_CUST_ID]] = $one;
            }
        }
        return $result;
    }
public function getStateOnDate($datestamp, $addCountryCode = false)
    {
        $result = [];
        $bind = [];
        $bind[QBldMax::BND_ON_DATE] = $datestamp;
        $query = $this->qbuildSnapOnDate->build();
        if ($addCountryCode) {
            /* define tables aliases */
            $as = self::AS_TBL_DWNL;
            $tbl = $this->resource->getTableName(ECustomer::ENTITY_NAME);
            $on = $as . '.' . ECustomer::A_CUSTOMER_REF . '='
                . QBldSnap::AS_DWNL_SNAP . '.' . Entity::A_CUSTOMER_REF;
            $cols = [
                self::A_COUNTRY => ECustomer::A_COUNTRY_CODE,
                self::A_MLM_ID => ECustomer::A_MLM_ID
            ];
            $query->joinLeft([$as => $tbl], $on, $cols);
        }
        $query->order(
            QBldSnap::AS_DWNL_SNAP . '.'
            . \Praxigento\Downline\Repo\Data\Snap::A_DEPTH
        );
        $rows = $this->conn->fetchAll($query, $bind);
        if (count($rows)) {
            foreach ($rows as $one) {
                $result[$one[\Praxigento\Downline\Repo\Query\Snap\OnDate\Builder::A_CUST_ID]] = $one;
            }
        }
        return $result;
    }
public function getStateOnDate ( $ datestamp , $ addCountryCode = false ) { $ result = [ ] ; $ bind = [ ] ; $ bind [ QBldMax :: BND_ON_DATE ] = $ datestamp ; $ query = $ this -> qbuildSnapOnDate -> build ( ) ; if ( $ addCountryCode ) { /* define tables aliases */ $ as = self :: AS_TBL_DWNL ; $ tbl = $ this -> resource -> getTableName ( ECustomer :: ENTITY_NAME ) ; $ on = $ as . '.' . ECustomer :: A_CUSTOMER_REF . '=' . QBldSnap :: AS_DWNL_SNAP . '.' . Entity :: A_CUSTOMER_REF ; $ cols = [ self :: A_COUNTRY => ECustomer :: A_COUNTRY_CODE , self :: A_MLM_ID => ECustomer :: A_MLM_ID ] ; $ query -> joinLeft ( [ $ as => $ tbl ] , $ on , $ cols ) ; } $ query -> order ( QBldSnap :: AS_DWNL_SNAP . '.' . \ Praxigento \ Downline \ Repo \ Data \ Snap :: A_DEPTH ) ; $ rows = $ this -> conn -> fetchAll ( $ query , $ bind ) ; if ( count ( $ rows ) ) { foreach ( $ rows as $ one ) { $ result [ $ one [ \ Praxigento \ Downline \ Repo \ Query \ Snap \ OnDate \ Builder :: A_CUST_ID ] ] = $ one ; } } return $ result ; }
Select downline tree state on the given datestamp.

@param $datestamp string 'YYYYMMDD'
@param $addCountryCode 'true' to add actual country code for customer's attributes

@return array
Select downline tree state on the given datestamp .