Commits

Anonymous committed 8026b9b

Add lease wizard confimation page changes

Comments (0)

Files changed (2)

application/modules/unit/controllers/LeasewizardController.php

             if( $this->getRequest()->isPost()	        
 	        and $this->_getParam('next') ) {		          
 	      
-	        $leaseWizard = new Unit_Model_LeaseWizard();
-		$leaseWizard->createLease();
+	        //$leaseWizard = new Unit_Model_LeaseWizard();
+		$leaseWizardItem->createLease();
 		
 	      /*	    
 	        //$this->_helper->redirector('selecttenets', 'leasewizard', 'unit');

application/modules/unit/models/LeaseWizard.php

      */
     function createLease() {
 	// tenets
-	
-	var_dump( $this->getWizardVariable( 'tenet' ) ); 
-	
-	// leasewizardScheduleItem
-	var_dump( $this->getWizardVariable( 'modelRentScheduleId' ) );
-	
-	// leasewizardScheduleItem
-	var_dump( $this->getWizardVariable( 'modelRentScheduleItemId' ) );	
-	
-	// discount
-	var_dump( $this->getWizardVariable( 'discount' ) );
-	
-	// effectiveDate
-	var_dump( $this->getWizardVariable( 'effectiveDate' ) );
-	// unitId
-	var_dump( $this->getWizardVariable( 'unitId' ) );
-	
-	// accountId
-	var_dump( $this->getWizardVariable( 'accountLinkId' ) );
-	var_dump( $this->getWizardVariable( 'referenceNumber' ) );
-	var_dump( $this->getWizardVariable( 'comment' ) );	
-	
 		
 	$db = Zend_Registry::get('db'); // used for all in transaction		
 	
 	    
 	    // Set and save to lease table
 	    $lease = new Unit_Model_Lease( $formValues );
-	    $lease->setEffectiveDate( $this->getWizardVariable( 'effectiveDate' ) );
-	    $lease->setUnitId( $this->getWizardVariable( 'unitId' ) );
-	    $lease->setModelRentScheduleId( $this->getWizardVariable( 'modelRentScheduleId' )  );	    
+	    $lease->setEffectiveDate( $this->getEffectiveDate() );
+	    $lease->setUnitId( $this->getUnitId() );
+	    $lease->setModelRentScheduleId( $this->getModelRentScheduleId()  );	    
 	    $leaseId = $lease->save();
 	    
 	    // Set and save discounts to leaseDiscount table
 	    $leaseSchedule->setLeaseId( $leaseId );
 	    
 	    // grab the numMonths on the rentschedule
-	    $rsi = new Unit_Model_ModelRentScheduleItem($formValues);
-	    $rentScheduleItem = $rsi->findById( $this->getWizardVariable( 'modelRentScheduleItemId' ) );
+	    $rsi = new Unit_Model_ModelRentScheduleItem($formValues);	    
+	    $rentScheduleItem = $rsi->findById( $this->getModelRentScheduleItemId() );
+	    //var_dump($this); die;
 	    
-	    $discount = $this->getWizardVariable( 'discount' );
+	    $discount = $this->getDiscount();
 	    
 	    for ( $i=1;  $i <= $rentScheduleItem->getNumMonths(); $i++ ) {
 		$disc = ( isset( $discount[$i] ) )? $discount[$i] : 0;
 	    }
 	    
 	    // save tenets
-	    /*
+	    
 	    $tenetModel = new Unit_Model_Tenet($formValues);
 	    $tenetModel->setLeaseId( $leaseId );
 	   
-	    foreach( $this->getWizardVariable( 'tenet' ) as $id=>$user ) {
+	    foreach( $this->getTenet() as $id=>$user ) {
 		$tenetModel->setUserId( $id );
 		$tenetModel->save();
-	    }    	    	    	    
-	    */       	      
+	    }    	    	    	    	           	      
 	     
 	    $rent = $rentScheduleItem->getRentAmount();
 	    
 	    
 	    $billModel = $billCreation->getBillModel();
 	    // set common bill info
-	    $billModel->setAccountLinkId( $this->getWizardVariable( 'accountLinkId' ) );
+	    $billModel->setAccountLinkId( $this->getAccountLinkId() );
 	    
 	    // set transaction info
 	    $transactionModel = $billCreation->getTransactionModel();
 	    $transactionModel->setAction('lease creation');
-	    $transactionModel->setComment( $this->getWizardVariable( 'comment' ) );
+	    $transactionModel->setComment( $this->getComment());	    
 	    
 	    $accountTransactionModel = $billCreation->getAccountTransactionModel();
-	    $accountTransactionModel->setReferenceNumber( $this->getWizardVariable( 'referenceNumber' ) );
+	    $accountTransactionModel->setReferenceNumber( $this->getReferenceNumber() );
+	    $accountTransactionModel->setAccountLink( $this->getAccountLink() );
 	    	    	    	        
 	    for ( $i=1;  $i <= $rentScheduleItem->getNumMonths(); $i++ ) {
 		// amount from rent model - discount = original amount due
 		$accountTransactionModel->setAmount( $amountDue );
 		
 		//  Second param needed or else 2010-05-1 is being read as Jan 5 2010 instead of May 1 2010
-		$date = new Zend_Date($this->getWizardVariable( 'effectiveDate' ),'YYYY-MM-dd' );
+		$date = new Zend_Date($this->getEffectiveDate(),'YYYY-MM-dd' );
 		//Zend_Date::setOptions(array('format_type' => 'php'));
 		//$date =  new Zend_Date($this->getWizardVariable( 'effectiveDate' ), null,Zend_Registry::get('Zend_Locale'));					
 		//var_dump( $date ); die;
 		$accountTransactionModel->setDatePosted( $date->toString('YYYY-MM-dd') );
 		
 	        $billCreation->createBill();
+		
+		// TODO add to billLease table
 	    } 
 	    $db->commit();
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.