public function editcropAction()
 {
     $this->view->title = $this->view->translate('Edit Contact');
     $this->view->title = $this->view->translate('Add Crop');
     //Base line data
     $familycommon = new Familycommonview_Model_familycommonview();
     $this->view->memberid = $this->_getParam('id');
     $this->view->membername = $familycommon->getfamily($this->_getParam('id'));
     //agriculture view
     $this->view->agriculture = $edit_agriculture = $familycommon->getagriculturedetails($this->_getParam('id'));
     $this->view->acretotal = $familycommon->getacretotal($this->_getParam('id'));
     $this->view->guntatotal = $familycommon->getguntatotal($this->_getParam('id'));
     $revvillageid = $this->view->membername[0]['rev_village_id'];
     if ($revvillageid) {
         $revvillagename = $this->view->adm->editRecord("ourbank_master_villagelist", $revvillageid);
     }
     //getting module id and submodule id
     $module = $familycommon->getmodule('Family');
     foreach ($module as $module_id) {
     }
     $this->view->mod_id = $module_id['parent'];
     $this->view->sub_id = $module_id['module_id'];
     $this->view->insurance = $familycommon->getinsurance($this->_getParam('id'));
     //load crop details form with two arguments ...
     $form = new Crop_Form_Crop($this->_getParam('id'), $this->_getParam('subId'));
     $this->view->form = $form;
     $this->view->id = $this->_getParam('id');
     $this->view->submitform = new Crop_Form_Submit();
     //dynamically change the path name
     $addressmodel = new Address_Model_addressInformation();
     $module_name = $addressmodel->getmodule($this->view->subId);
     foreach ($module_name as $module_view) {
         $path1 = $module_view['module_description'] . 'commonview';
     }
     $path1 = $this->view->path1 = strtolower($path1);
     $crop = new Crop_Model_Crop();
     $this->view->cropdetails = $crop->getCrop();
     $this->view->seasondetails = $crop->getSeason();
     $this->view->units = $crop->getUnits();
     //update contact details
     if ($this->_request->getPost('submit')) {
         $formdata = $this->_request->getPost();
         //             echo '<pre>'; print_r($formdata);
         //   if($formdata['enteredacre']>=$formdata['availableacre']){
         //   $this->view->errormsg="<p style='color:red;'>The Entered acres should be less than or equal to ".$formdata['availableacre'];
         //   } else {
         $id = $this->_getParam('id');
         $crop = new Crop_Model_Crop();
         $editCrop = $crop->getCropdetails($id);
         for ($j = 0; $j < count($editCrop); $j++) {
             $this->view->adm->addRecord("ourbank_cropdetails_log", $editCrop[$j]);
         }
         $crop->deletecrop($id);
         $tenant = $this->_getParam('tenant');
         $acer = $this->_getParam('acre');
         $gunta = $this->_getParam('gunta');
         $season = $this->_getParam('season');
         $unit = $this->_getParam('unit');
         $quantity = $this->_getParam('quantity');
         $marketed = $this->_getParam('marketed');
         $price = $this->_getParam('price');
         $realised = $this->_getParam('realised');
         $soldDate = $this->_getParam('date');
         $dateconvert = new App_Model_dateConvertor();
         $i = 0;
         foreach ($this->_getParam('crop_id') as $val) {
             if ($soldDate[$i]) {
                 if ($soldDate[$i] == "00/00/0000" or $soldDate[$i] == NULL) {
                     $date = date("y/m/d H:i:s");
                 } else {
                     $date = $dateconvert->mysqlformat($soldDate[$i]);
                 }
             } else {
                 echo $date = date("y/m/d H:i:s");
             }
             $crop = array('family_id' => $id, 'crop_id' => $val, 'land_id' => $tenant[$i], 'season_id' => $season[$i], 'acre' => $acer[$i], 'gunta' => $gunta[$i], 'unit' => $unit[$i], 'quantity' => $quantity[$i], 'marketed' => $marketed[$i], 'price' => $price[$i], 'realised' => $realised[$i], 'sold_date' => $date);
             $i++;
             $this->view->adm->addRecord("ourbank_cropdetails", $crop);
         }
         $this->_redirect('/familycommonview/index/commonview/id/' . $id);
         //   }
     } else {
         //set the contact details in the contact form...
         $sub_id = $this->_getParam('subId');
         $id = $this->_getParam('id');
         $individualcommon = new Familycommonview_Model_familycommonview();
         $this->view->editCrop = $individualcommon->getcrop($this->_getParam('id'));
     }
 }
 public function commonviewAction()
 {
     // //         //Acl
     // //         //$access = new App_Model_Access();
     // //         //$checkaccess = $access->accessRights('Individual',$this->view->globalvalue[0]['name'],'commonviewAction');
     // //         //if (($checkaccess != NULL)) {
     $id = $this->_request->getParam('id');
     $this->view->memberid = $id;
     $familycommon = new Familycommonview_Model_familycommonview();
     $member_name = $familycommon->getfamily($id);
     $villageid = $member_name[0]['rev_village_id'];
     $parentid = $member_name[0]['parentoffice_id'];
     $talukname = $familycommon->gettalukname($villageid);
     if ($talukname) {
         $this->view->villagename = $talukname[0]['name'];
     }
     $kootaname = $familycommon->getkoota($parentid);
     if ($kootaname) {
         $this->view->kootaname = $kootaname[0]['name'];
     }
     //getting module id and submodule id
     $module = $familycommon->getmodule('Family');
     $this->view->mod_id = $module[0]['parent'];
     $this->view->sub_id = $module[0]['module_id'];
     $officemodule = $familycommon->getmodule('Office');
     //print_r($officemodule);
     $officesub_id = $officemodule[0]['module_id'];
     $pincode1 = $familycommon->getpincode($officesub_id, $villageid);
     if ($pincode1) {
         $this->view->pincode1 = $pincode1[0]['zipcode'];
     }
     $this->view->insurance = $familycommon->getinsurance($id);
     //         //geting family details, family details, health, economic, education details
     $this->view->membername = $member_name;
     // //      $this->view->family =$familycommon->getfamilydetails($id);
     $this->view->agriculture = $edit_agriculture = $familycommon->getagriculturedetails($id);
     $this->view->acretotal = $familycommon->getacretotal($id);
     $this->view->guntatotal = $familycommon->getguntatotal($id);
     $this->view->family = $familycommon->getfamilydetails($id);
     // //        $this->view->getentitlement=$familycommon->getentitlement();
     $this->view->crop = $familycommon->getcrop($id);
     $this->view->loandetails = $familycommon->getloandetails($id);
     $this->view->savingsdetails = $familycommon->getsavingsdetails($id);
     $this->view->gethabithealth = $familycommon->gethabithealth($id);
     $this->view->gethabitchallenge = $familycommon->gethabitphychallenge($id);
     $this->view->getchronicdisease = $familycommon->getchronicdisease($id);
     $this->view->getfamilymembers = $familycommon->getfamilyname($id);
     $this->view->livingassets = $familycommon->getlivingassetsdetails($id);
     $this->view->nonlivingassets = $familycommon->getnonlivingassetsdetails($id);
     // 	//PRA Based Services
     $this->view->praservice = $familycommon->praservice($id);
     $this->view->expense = $familycommon->getexpense($id);
     // 	// Basic Infrastructure
     $this->view->housingtype = $familycommon->housingtype($id);
     $this->view->ownership = $familycommon->ownership($id);
     $this->view->cookfuel = $familycommon->cookfuel($id);
     // 	//Annual income details
     $this->view->incomedetails = $familycommon->getincomedetails($id);
     $this->view->incometotal = $familycommon->getincometotal($id);
     // /*
     // // 	$this->view->loandtotal=$individualcommon->getloantotal($id);
     // //         $this->view->servicedetails=$individualcommon->servicedetails($id);
     // //         $this->view->family =$individualcommon->getfamilydetails($id);
     // //        $this->view->activities=$individualcommon->getactivities($id);
     //         //}
     //         //else {
     //         //$this->_redirect('index/index');
     //         //}*/
 }