public function vlmisAction()
 {
     $salt = '159jboFHjeQK5mc1K0cdSz5';
     $token = sha1(md5($salt . date('Y-m-d')));
     if (!$this->_identity->login('userdashboard', base64_encode(123))) {
         $error = true;
         throw new Exception();
     }
     if ($token != $_GET['token']) {
         $this->view->message = 'Invalid Token';
     }
     $province = isset($_GET['combo1']) ? $_GET['combo1'] : 1;
     $level = isset($_GET['office']) ? $_GET['office'] : 1;
     $role_id = 4;
     $this->view->level = $level;
     $this->view->province = $province;
     $this->_helper->layout->setLayout('vlmis-dashboad');
     $auth = App_Auth::getInstance();
     //$role_id = $auth->getRoleId();
     $campaign = new Model_Campaigns();
     $location = new Model_Locations();
     $location->form_values = array('geo_level_id' => 4, 'province_id' => $province);
     $res = $location->getLocationsByLevelByProvince();
     $district = $res[0]['key'];
     $this->view->district = $district;
     switch ($level) {
         case 1:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
         case 2:
             $location->form_values = array("province_id" => $province);
             $dists = $location->districtLocations();
             foreach ($dists as $dist) {
                 $arr_dist[] = $dist['pk_id'];
             }
             $campaign->form_values = array("districts" => implode(",", $arr_dist));
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         case 6:
             $campaign->form_values = array("districts" => $district);
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         default:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
     }
     $this->view->provinces = $location->getProvincesName();
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllItemsByCategoryAndActivity("1", "1");
     // Default Filters for IM
     $this->view->item = 6;
     $this->view->date = Zend_Registry::get('report_month');
     // Default Filters for Campaign
     $this->view->camp = 23;
     $this->view->user_role = $role_id;
     $this->view->prov = $province;
     $r = $this->_request->getParam("ri_btn", '');
     if ($r == 'ri') {
         $this->view->r = $r;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $i = $this->_request->getParam("im_btn", '');
     if ($i == 'im') {
         $this->view->i = $i;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $c = $this->_request->getParam("camp_btn", '');
     if ($c == 'camp') {
         $this->view->c = $c;
         $this->view->camp = $this->_request->getParam("camp", '');
         $this->view->prov = $this->_request->getParam("prov", '');
     }
     $role_resource = new Model_RoleResources();
     $role_resource->form_values = array('type_id' => 3, 'role_id' => $role_id);
     $dashboards = $role_resource->getRoleResourcesByTypeForVlmisDashboard();
     $this->view->dashboards = $dashboards;
     $this->view->ri = 472;
     $this->view->im = 330;
     $this->view->campaign = 333;
     $period = new Model_Period();
     $time_intervals = $period->getTimeIntervals();
     $this->view->time_intervals = $time_intervals;
     $this->view->quarter = Model_Period::QUARTER;
     $this->view->halfyear = Model_Period::HALFYEAR;
     $this->view->annual = Model_Period::ANNUAL;
     $base_url = Zend_Registry::get('baseurl');
     $this->view->inlineScript()->appendFile($base_url . '/js/all_level_area_combo.js');
     $this->view->id = $this->_request->getParam("id", $dashboards[0]->getResource()->getPkId());
     /* if ($role_id == 7) {
        $this->view->province = $this->_identity->getProvinceId();
        $this->renderScript("dashboard/user-tehsil.phtml");
        } */
 }
    public function allLevelCampaign($data_array)
    {
        $identity = App_Auth::getInstance();
        $translate = Zend_Registry::get('Zend_Translate');
        $base_url = Zend_Registry::get('baseurl');
        $user_lvl = $identity->getRoleId();
        $districts_array = false;
        $office = $data_array["level"];
        $province = $data_array["province"];
        $district = $data_array["district"];
        $facility_type = $data_array["facility_type"];
        if (!empty($province)) {
            $locations = new Model_Locations();
            $locations->form_values = array('parent_id' => 10, 'geo_level_id' => 2);
            $provinces_array = $locations->getLocationsByLevel();
        }
        if (!empty($district)) {
            $location = new Model_Locations();
            $location->form_values = array('province_id' => $province, 'geo_level_id' => 4);
            $districts_array = $location->getLocationsByLevelByProvince();
        }
        switch ($user_lvl) {
            case 1:
            case 2:
            case 3:
                $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District'));
                break;
            case 4:
                $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District'));
                break;
            case 5:
                $arr_province = array('2' => $translate->translate('Province'));
                break;
            case 6:
                $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District'));
                break;
            case 7:
                $arr_province = array();
            case 8:
                $arr_province = array('6' => $translate->translate('District'));
                break;
            default:
                $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'));
                break;
        }
        if ($facility_type == 3) {
            $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District'));
        }
        ?>

        <?php 
        if ($facility_type != 1 && $facility_type != 2) {
            ?>
            <div class="col-md-2" id="div_office_combo">
                <label class="control-label" for="office"><?php 
            if (empty($office_term)) {
                echo $translate->translate("Office");
            } else {
                echo $office_term;
            }
            ?>
 </label>
                <div class="controls">
                    <select name="office" id="office" class="form-control input-small">
                        <option value=""><?php 
            echo $translate->translate("Select");
            ?>
</option>
                        <?php 
            foreach ($arr_province as $key => $value) {
                ?>
                            <option value="<?php 
                echo $key;
                ?>
" <?php 
                if ($key == $office) {
                    ?>
selected=""<?php 
                }
                ?>
 ><?php 
                echo $value;
                ?>
</option>
                        <?php 
            }
            ?>
                    </select>
                </div>
            </div>
        <?php 
        }
        ?>
        <div class="col-md-2" id="div_combo1" <?php 
        if (empty($province)) {
            ?>
 style="display:none;" <?php 
        }
        ?>
>
            <label class="control-label" id="lblcombo1">
                <?php 
        echo $translate->translate("Province");
        ?>
 
                <span class="red">*</span>
            </label>
            <div class="controls">
                <select name="combo1" id="combo1" class="form-control input-small">
                    <?php 
        if ($provinces_array != false) {
            ?>
                        <option value=""><?php 
            echo $translate->translate("Select");
            ?>
</option>
                        <?php 
            foreach ($provinces_array as $row) {
                ?>
                            <option value="<?php 
                echo $row['key'];
                ?>
" <?php 
                if (!empty($province) && $row['key'] == $province) {
                    echo 'selected';
                }
                ?>
>
                                <?php 
                echo $row['value'];
                ?>
</option>
                            <?php 
            }
        }
        ?>
                </select>
            </div>
        </div>	
        <div class="col-md-2" id="div_combo2" <?php 
        if ($district == '') {
            ?>
 style="display:none;" <?php 
        }
        ?>
>		
            <label class="control-label" id="lblcombo2">
                <?php 
        echo $translate->translate("District");
        ?>
 
                <span class="red">*</span>
            </label>
            <div class="controls">
                <select name="combo2" id="combo2" class="form-control input-small">
                    <?php 
        if ($districts_array != false) {
            ?>
                        <option value=""><?php 
            echo $translate->translate("Select");
            ?>
</option>
                        <?php 
            foreach ($districts_array as $row) {
                ?>
                            <option value="<?php 
                echo $row['key'];
                ?>
" <?php 
                if (!empty($district) && $row['key'] == $district) {
                    echo 'selected';
                }
                ?>
>
                                <?php 
                echo $row['value'];
                ?>
</option>
                            <?php 
            }
        }
        ?>
                </select>
            </div>
        </div>
        <div class="col-md-1" id="loader" style="display:none;">
            <img src="<?php 
        echo $base_url;
        ?>
/images/loader.gif" style="margin-top:8px; float:left" alt="" />
        </div>
        <?php 
        return true;
    }
Пример #3
0
 public function allLevelCombosTwoAction()
 {
     $this->_helper->layout->disableLayout();
     if (isset($this->_request->combo1) && !empty($this->_request->combo1)) {
         $office = $this->_request->office;
         $province_id = $this->_request->combo1;
         $location = new Model_Locations();
         $location->form_values = array('province_id' => $province_id, 'geo_level_id' => 4);
         $warehouse = new Model_Warehouses();
         switch ($office) {
             case 2:
                 $stakeholder_id = $this->_identity->getStakeholderId();
                 $warehouse->form_values = array('stakeholder_id' => $stakeholder_id, 'province_id' => $province_id);
                 $this->view->result = $warehouse->getProvincialWarehouses();
                 break;
             case 3:
                 $stakeholder_id = $this->_identity->getStakeholderId();
                 $warehouse->form_values = array('stakeholder_id' => $stakeholder_id, 'province_id' => $province_id);
                 $this->view->result = $warehouse->getDivsionalWarehousesofProvince();
                 break;
             case 4:
                 $stakeholder_id = $this->_identity->getStakeholderId();
                 $warehouse->form_values = array('stakeholder_id' => $stakeholder_id, 'province_id' => $province_id);
                 $this->view->result = $warehouse->getDistrictWarehousesofProvince();
                 break;
             case 5:
                 $this->view->result = $location->getLocationsByLevelByProvince();
                 break;
             case 6:
                 $this->view->result = $location->getLocationsByLevelByProvince();
                 break;
             case 8:
                 $this->view->result = $location->getLocationsByLevelByProvince();
                 break;
             case 9:
                 $this->view->result = $location->getLocationsByLevelByProvince();
                 break;
         }
     }
 }
 public function simpleGraphsAction()
 {
     if ($this->_request->isPost()) {
         $post = $this->_request->getPost();
         $graphs = new Model_Graphs();
         $graphs->form_values = $post;
         $optvals = $post['optvals'];
         if (in_array($optvals, array(9, 10, 11))) {
             $xmlstore = $graphs->simpleGraphOptionYearNational();
         }
         $this->view->xmlstore = $xmlstore;
         //print_r($post);
         $this->view->chart_type = $post['ctype'];
         $this->view->sel_indicator = $post['indicators'];
         $this->view->sel_product = $post['products'];
         $this->view->sel_optvals = $post['optvals'];
         $this->view->sel_period = $post['period'];
         $this->view->sel_year = $post['yearcomp'];
         $this->view->sel_province = $post['all_provinces'];
         $this->view->sel_district = $post['all_districts'];
         if (in_array($optvals, array(10, 11))) {
             $locations = new Model_Locations();
             $locations->form_values = array('parent_id' => 10, 'geo_level_id' => 2);
             $this->view->combo_provinces = $locations->getLocationsByLevel();
         }
         if ($optvals == 11) {
             $location = new Model_Locations();
             $location->form_values = array('province_id' => $post['all_provinces'], 'geo_level_id' => 4);
             $this->view->combo_districts = $location->getLocationsByLevelByProvince();
         }
     } else {
         $this->view->sel_optvals = 9;
     }
     $reports = new Model_Reports();
     $indicators = $reports->getIndicators();
     $this->view->indicators = $indicators;
     $products = new Model_ItemPackSizes();
     $product = $products->getAllItemsNonDil();
     $this->view->product = $product;
     $compare_option = array("Geographical" => array("9" => "National", "10" => "Provincial", "11" => "District"));
     $this->view->compare_option = $compare_option;
     $period = new Model_Period();
     $time_intervals = $period->getTimeIntervals();
     $this->view->time_intervals = $time_intervals;
     $this->view->quarter = Model_Period::QUARTER;
     $this->view->halfyear = Model_Period::HALFYEAR;
     $this->view->annual = Model_Period::ANNUAL;
     $years = array();
     for ($i = 2013; $i <= date("Y"); $i++) {
         $years[] = $i;
     }
     $this->view->years = $years;
     $chart_type = array('Line' => "Line", 'Column3D' => "Bar");
     $this->view->chart_types = $chart_type;
     $this->view->main_heading = "Simple Graphs";
 }
 public function indexAction()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     $campaign = new Model_Campaigns();
     $location = new Model_Locations();
     // National Level
     if ($role_id == 3 || $role_id == 23 || $role_id == 26 || $role_id == 27) {
         $this->view->level = 1;
     }
     // Provincial Level
     if ($role_id == 4 || $role_id == 23) {
         $this->view->level = 2;
         $province = $this->_identity->getProvinceId();
         $this->view->province = $province;
     }
     // 6 - District Level, 20 - Policy District User
     if ($role_id == 6 || $role_id == 7 || $role_id == 20 || $role_id == 21 || $role_id == 23) {
         $this->view->level = 6;
         $province = $this->_identity->getProvinceId();
         $district = $this->_identity->getDistrictId();
         $this->view->province = $province;
         $this->view->district = $district;
     }
     // National Campaign
     if ($role_id == 14 || $role_id == 23) {
         $province = 1;
         $this->view->province = $province;
         $district = 33;
         $this->view->district = $district;
     }
     // Provincial Campaign
     if ($role_id == 15 || $role_id == 23) {
         $province = $this->_identity->getUserLocationId();
         $this->view->province = $province;
     }
     // District Campaign
     if ($role_id == 16 || $role_id == 23) {
         $province = $this->_identity->getUserProvinceId();
         $district = $this->_identity->getUserLocationId();
         $this->view->province = $province;
         $this->view->district = $district;
     }
     if ($role_id == 17 || $role_id == 18 || $role_id == 23 || $role_id == 25 || $role_id == 26 || $role_id == 28 || $role_id == 29) {
         $province = 1;
         $district = 33;
         $this->view->province = $province;
         $this->view->district = $district;
         $this->view->level = 1;
     }
     if ($role_id == 27) {
         $province = 2;
         $district = 87;
         $this->view->province = $province;
         $this->view->district = $district;
         $this->view->level = 1;
     }
     if ($role_id == 30) {
         $province = $this->_identity->getProvinceId();
         $district = $this->_identity->getDistrictId();
         $this->view->province = $province;
         $this->view->district = $district;
         $this->view->level = 1;
     }
     if ($role_id == 31) {
         $province = 4;
         $district = 80;
         $this->view->province = $province;
         $this->view->district = $district;
         $this->view->level = 1;
     }
     $sel_lvl = $this->_request->getParam("office");
     if (!empty($sel_lvl)) {
         $level = $sel_lvl;
         $this->view->level = $level;
     }
     $sel_prov = $this->_request->getParam("combo1");
     if (!empty($sel_prov)) {
         $province = $sel_prov;
         $this->view->province = $province;
     }
     if ($role_id == 3 && empty($province)) {
         $province = 1;
         $this->view->province = $province;
     }
     $sel_dist = $this->_request->getParam("combo2");
     if (!empty($sel_dist)) {
         $district = $sel_dist;
         $this->view->district = $district;
     }
     if ($role_id == 3 && empty($district)) {
         $district = 33;
         $this->view->district = $district;
     }
     if ($role_id == 4 && empty($district)) {
         $location->form_values = array('geo_level_id' => 4, 'province_id' => $province);
         $res = $location->getLocationsByLevelByProvince();
         $district = $res[0]['key'];
         $this->view->district = $district;
     }
     switch ($level) {
         case 1:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
         case 2:
             $location->form_values = array("province_id" => $province);
             $dists = $location->districtLocations();
             foreach ($dists as $dist) {
                 $arr_dist[] = $dist['pk_id'];
             }
             $campaign->form_values = array("districts" => implode(",", $arr_dist));
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         case 6:
             $campaign->form_values = array("districts" => $district);
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         default:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
     }
     $this->view->provinces = $location->getProvincesName();
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllVaccines();
     // Default Filters for IM
     $this->view->item = 6;
     $this->view->date = Zend_Registry::get('report_month');
     // Default Filters for Campaign
     $this->view->camp = 23;
     $this->view->user_role = $role_id;
     $this->view->prov = $this->_identity->getProvinceId();
     $r = $this->_request->getParam("ri_btn", '');
     if ($r == 'ri') {
         $this->view->r = $r;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $i = $this->_request->getParam("im_btn", '');
     if ($i == 'im') {
         $this->view->i = $i;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $c = $this->_request->getParam("camp_btn", '');
     if ($c == 'camp') {
         $this->view->c = $c;
         $this->view->camp = $this->_request->getParam("camp", '');
         $this->view->prov = $this->_request->getParam("prov", '');
     }
     $role_resource = new Model_RoleResources();
     $role_resource->form_values = array('type_id' => 3, 'role_id' => $role_id);
     $dashboards = $role_resource->getRoleResourcesByType();
     $this->view->dashboards = $dashboards;
     $this->view->ri = 472;
     $this->view->im = 330;
     $this->view->campaign = 333;
     $period = new Model_Period();
     $time_intervals = $period->getTimeIntervals();
     $this->view->time_intervals = $time_intervals;
     $this->view->quarter = Model_Period::QUARTER;
     $this->view->halfyear = Model_Period::HALFYEAR;
     $this->view->annual = Model_Period::ANNUAL;
     $base_url = Zend_Registry::get('baseurl');
     $this->view->inlineScript()->appendFile($base_url . '/js/all_level_area_combo.js');
     if ($role_id == 4 || $role_id == 5 || $role_id == 6 || $role_id == 7) {
         $stock_master = new Model_StockMaster();
         $this->view->pending_receive = $stock_master->getPendingReceive();
         $this->view->warehouse_name = $auth->getWarehouseName();
     }
     $this->view->id = $this->_request->getParam("id", $dashboards[0]->getResource()->getPkId());
     /* if ($role_id == 7) {
        $this->view->province = $this->_identity->getProvinceId();
        $this->renderScript("dashboard/user-tehsil.phtml");
        } */
 }
    public function allLevelComboAllColdChainEquipment($office_term = "", $postfix = null, $data_array)
    {
        $identity = App_Auth::getInstance();
        $translate = Zend_Registry::get('Zend_Translate');
        $base_url = Zend_Registry::get('baseurl');
        $user_lvl = $identity->getUserLevel($identity->getIdentity());
        $stakeholder_id = $identity->getStakeholderId();
        $warehouse = new Model_Warehouses();
        $office = $data_array["level"];
        $province = $data_array["province"];
        $district = $data_array["district"];
        $warehouse_id = $data_array["warehouse"];
        if ($office == 1) {
            $warehouse->form_values = array('stakeholder_id' => $stakeholder_id);
            switch ($office) {
                case 1:
                    $warehouse_array = $warehouse->getFederalWarehouses();
                    break;
            }
        }
        if (!empty($province)) {
            $locations = new Model_Locations();
            $locations->form_values = array('parent_id' => 10, 'geo_level_id' => 2);
            $provinces_array = $locations->getLocationsByLevel();
            if (empty($district)) {
                $warehouse->form_values = array('province_id' => $province, 'stakeholder_id' => $stakeholder_id);
                switch ($office) {
                    case 1:
                        $warehouse_array = $warehouse->getFederalWarehouses();
                        break;
                    case 2:
                        $warehouse_array = $warehouse->getProvincialWarehouses();
                        break;
                    case 4:
                        $warehouse_array = $warehouse->getDistrictWarehousesofProvince();
                        break;
                }
            }
        }
        if (!empty($district)) {
            $location = new Model_Locations();
            $location->form_values = array('province_id' => $province, 'geo_level_id' => 4);
            $districts_array = $location->getLocationsByLevelByProvince();
            $warehouse->form_values = array('district_id' => $district, 'stakeholder_id' => $stakeholder_id);
            switch ($office) {
                case 5:
                    $warehouse_array = $warehouse->getTehsilWarehousesofDistrict();
                    break;
                case 6:
                    $warehouse_array = $warehouse->getUCWarehousesofDistrict();
                    break;
                case 8:
                    $warehouse_array = $warehouse->getTehsilWarehousesofDistrict();
                    break;
                case 9:
                    $warehouse_array = $warehouse->getUCWarehousesofDistrict();
                    break;
            }
        }
        switch ($user_lvl) {
            case 1:
            case 2:
            case 3:
                $arr_levels = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '4' => $translate->translate('District'), '8' => $translate->translate('Tehsil-Taluka'), '9' => $translate->translate('UC'));
                break;
            case 4:
                $arr_levels = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '4' => $translate->translate('District'), '8' => $translate->translate('Tehsil-Taluka'), '9' => $translate->translate('UC'));
                break;
            case 5:
                $arr_levels = array('2' => $translate->translate('National'), '4' => $translate->translate('District'));
                break;
            case 6:
                $arr_levels = array('2' => $translate->translate('Province'), '5' => $translate->translate('Tehsil-Taluka'), '6' => $translate->translate('Union Council'));
                break;
            case 7:
                $arr_levels = array('7' => $translate->translate('District'), '6' => $translate->translate('Union Council'));
            case 8:
                $arr_levels = array('7' => $translate->translate('District'), '5' => $translate->translate('Tehsil-Taluka'), '6' => $translate->translate('Union Council'));
                break;
            default:
                $arr_levels = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '4' => $translate->translate('District'), '5' => $translate->translate('Tehsil-Taluka'), '6' => $translate->translate('Union Council'));
                break;
        }
        ?>
        <div class="row">
            <div class="col-md-12" id="all_level_combo">
                <div class="col-md-3">
                    <div class="control-group">
                        <label class="control-label" for="office" class="col-md-7"><?php 
        echo $translate->translate("Level");
        ?>
</label>
                        <div class="controls">
                            <select name="office" id="office<?php 
        echo $postfix;
        ?>
" class="form-control">
                                <option value=""><?php 
        echo $translate->translate("Select");
        ?>
</option>
                                <?php 
        foreach ($arr_levels as $key => $value) {
            ?>
                                    <option value="<?php 
            echo $key;
            ?>
" <?php 
            if (!empty($office) && $key == $office) {
                echo 'selected';
            }
            ?>
><?php 
            echo $value;
            ?>
</option>
                                <?php 
        }
        ?>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-md-3" id="div_combo1<?php 
        echo $postfix;
        ?>
" <?php 
        if ($office == 2 || !empty($province)) {
            ?>
 style="display:block;" <?php 
        } else {
            ?>
 style="display:none;"<?php 
        }
        ?>
>
                    <label class="control-label" id="lblcombo1"><?php 
        echo $translate->translate("Province");
        ?>
 </label>
                    <div class="controls">
                        <select name="combo1" id="combo1<?php 
        echo $postfix;
        ?>
" class="form-control">
                            <?php 
        if ($provinces_array != false) {
            ?>
                                <option value=""><?php 
            echo $translate->translate("Select");
            ?>
</option>
                                <?php 
            foreach ($provinces_array as $row) {
                ?>
                                    <option value="<?php 
                echo $row['key'];
                ?>
" <?php 
                if (!empty($province) && $row['key'] == $province) {
                    echo 'selected';
                }
                ?>
>
                                        <?php 
                echo $row['value'];
                ?>
</option>
                                    <?php 
            }
        }
        ?>
                        </select>
                    </div>
                </div>	
                <div class="col-md-3" id="div_combo2<?php 
        echo $postfix;
        ?>
" <?php 
        if ($office == 5 || !empty($district)) {
            ?>
 style="display:block;" <?php 
        } else {
            ?>
 style="display:none;"<?php 
        }
        ?>
>
                    <label class="control-label" id="lblcombo2"><?php 
        echo $translate->translate("District");
        ?>
 </label>
                    <div class="controls">
                        <select name="combo2" id="combo2<?php 
        echo $postfix;
        ?>
" class="form-control">
                            <?php 
        if ($districts_array != false) {
            ?>
                                <option value=""><?php 
            echo $translate->translate("Select");
            ?>
</option>
                                <?php 
            foreach ($districts_array as $row) {
                ?>
                                    <option value="<?php 
                echo $row['key'];
                ?>
" <?php 
                if (!empty($district) && $row['key'] == $district) {
                    echo 'selected';
                }
                ?>
>
                                        <?php 
                echo $row['value'];
                ?>
</option>
                                    <?php 
            }
        }
        ?>
                        </select>
                    </div>
                </div>
                <div class="col-md-3" id="wh_combo<?php 
        echo $postfix;
        ?>
" <?php 
        /*if (!empty($warehouse_id)) { ?> style="display:block;" <?php } else { ?> style="display:none;"<?php } */
        ?>
>
                    <label class="control-label" id="wh_l"><?php 
        echo $translate->translate("Warehouse");
        ?>
 <span class="red">*</span></label>
                    <div class="controls">
                        <select name="warehouse<?php 
        echo $postfix;
        ?>
" id="warehouse<?php 
        echo $postfix;
        ?>
" class="form-control">
                            <?php 
        if ($warehouse_array != false) {
            ?>
                                <option value=""><?php 
            echo $translate->translate("Select");
            ?>
</option>
                                <?php 
            foreach ($warehouse_array as $row) {
                ?>
                                    <option value="<?php 
                echo $row['key'];
                ?>
" <?php 
                if (!empty($warehouse_id) && $row['key'] == $warehouse_id) {
                    echo 'selected';
                }
                ?>
>
                                        <?php 
                echo $row['value'];
                ?>
</option>
                                    <?php 
            }
        }
        ?>

                        </select>
                    </div>
                </div>
                <div class="col-md-1" id="loader<?php 
        echo $postfix;
        ?>
" style="display:none;"><img src="<?php 
        echo $base_url;
        ?>
/images/loader.gif" style="margin-top:8px; float:left" alt="" /></div>
            </div>
        </div>
        <?php 
        return true;
    }
 public function stockAnalysisSummaryReportAction()
 {
     $this->_helper->layout->setLayout('reports');
     $this->view->report_id = 'DISTRICTWAREHOUSE';
     $this->view->report_title = 'Stock Analysis Summary Report';
     $this->view->actionpage = 'product-wise-districts-yearly-report';
     $this->view->parameters = 'TS01IP';
     $this->view->parameter_width = '100%';
     $item_pack_sizes = new Model_ItemPackSizes();
     $warehouses_data = new Model_WarehousesData();
     $item = $item_pack_sizes->productsReport();
     $this->view->item_id = $item;
     if (!empty($this->_request->ending_month) && !empty($this->_request->ending_month)) {
         $this->view->year_sel = $year = $this->_request->year_sel;
         $this->view->month_sel = $month = $this->_request->ending_month;
     } else {
         $year = date("Y");
         if (date('d') > 10) {
             $month = date("m", strtotime("-1"));
         } else {
             $month = date("m", strtotime("-2"));
         }
         $this->view->year_sel = $year;
         $this->view->month_sel = $month;
     }
     if (!empty($this->_request->rep_indicators)) {
         $this->view->sel_indicator = $sel_indicator = $this->_request->rep_indicators;
     } else {
         $this->view->sel_indicator = $sel_indicator = 1;
     }
     if (isset($this->_request->stk_sel) && !empty($this->_request->stk_sel)) {
         $this->view->stk_sel = $sel_stk = $this->_request->stk_sel;
     } else {
         $this->view->stk_sel = $sel_stk = 1;
     }
     $locations = new Model_Locations();
     if (!empty($this->_request->prov_sel)) {
         $prov_sel = $this->_request->prov_sel;
         $locations->form_values['pk_id'] = $this->_request->prov_sel;
         $this->view->location_name = $locations->getLocationName();
         $locations->form_values['geo_level_id'] = '4';
         $locations->form_values['province_id'] = $this->_request->prov_sel;
         $district = $locations->getLocationsByLevelByProvince();
         $this->view->district = $district;
     } else {
         $prov_sel = 1;
         $this->view->location_name = "Punjab";
         $locations->form_values['geo_level_id'] = '4';
         $locations->form_values['province_id'] = $prov_sel;
         $district = $locations->getLocationsByLevelByProvince();
         $this->view->district = $district;
     }
     $this->view->prov_sel = $prov_sel;
     $this->view->dist_sel = $this->_request->dist_id;
     if ($this->_request->dist_id) {
         $this->view->in_dist = $this->_request->dist_id;
         $this->view->sel_dist = $this->_request->dist_id;
     } else {
         $this->view->in_dist = $this->_request->prov_sel;
         $this->view->sel_dist = 0;
     }
     if ($sel_indicator == 1) {
         $str_indicator = "\\'Consumption\\'";
     } else {
         if ($sel_indicator == 2) {
             $str_indicator = "\\'Stock on Hand\\'";
         } else {
             if ($sel_indicator == 3) {
                 $str_indicator = "\\'Received\\'";
             } else {
                 if ($sel_indicator == 4) {
                     $str_indicator = "\\'Issued\\'";
                 }
             }
         }
     }
     $this->view->str_indicator = $str_indicator;
     $end_date1 = $year . '-' . $month . '-01';
     $end_date = date('Y-m-d', strtotime("-1 days", strtotime("+1 month", strtotime($end_date1))));
     $start_date = date('Y-m-d', strtotime("-364 days", strtotime($end_date)));
     // Start date and End date
     $begin = new DateTime($start_date);
     $end = new DateTime($end_date);
     $diff = $begin->diff($end);
     $interval = DateInterval::createFromDateString('1 month');
     $period = new DatePeriod($begin, $interval, $end);
     $this->view->period = $period;
     $this->view->sel_item = $this->_request->prod_sel;
     $stakeholder = new Model_Stakeholders();
     $stk = $stakeholder->nationReport();
     $this->view->stk = $stk;
     $locations = new Model_Locations();
     $lct = $locations->devisionalReport();
     $this->view->location = $lct;
 }