Beispiel #1
0
      			<td valign="top" nowrap><b><?php 
echo date("n/j/y H:i", $ta->start_ts) . "-" . date("H:i", $ta->end_ts);
?>
</b></td>
      			<td valign="top"><?php 
echo $ta->text;
?>
</td>
			</tr>
			</table>
		</td>
	</tr>
<?		}
		if($links[$x]->payment_schedule_id > 0){
			$ps = new SI_PaymentSchedule();
			$ps->get($links[$x]->payment_schedule_id); ?>
	<tr>
		<td colspan="11" class="dg_data_cell_1"><?php 
echo $ps->description;
?>
</td>
	</tr>
<?		} ?>
<? 	} // end for links
	if($i != count($activities)-1){?>
	<tr>
		<td colspan="11" class="dg_header_cell">&nbsp;</td>
	</tr>
<? 	} //If not last ?>
<? } //If detail ?>
<? }?>
			$_POST['due_ts'] = getTSFromInput($_POST['due_ts']);
			$ps->updateFromAssocArray($_POST);
			if($ps->add()){
				goBack();
			}else{
				$error_msg .= "Error adding Payment Schedule!\n";
				debug_message($ps->getLastError());
			}
		}
	}
}else if($_REQUEST['mode'] == 'edit'){
	$title = "Edit Payment Schedule";
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
	}else{
		if(!$ps->get($_REQUEST['id'])){
			$error_msg .= "Error retrieving payment information!\n";
			debug_message($ps->getLastError());
		}
	}

	if($ps->task_id > 0){
		if($task->get($ps->task_id) === FALSE){
			$error_msg .= "Error getting task information!\n";
			debug_message($task->getLastError());
		}

		if($project->get($task->project_id) === FALSE){
			$error_msg .= "Error getting project information!\n";
			debug_message($project->getLastError());
		}
	function getUnitPrice(){
		if($this->task_activity_id > 0){
			$ta = new SI_TaskActivity();
			if($ta->get($this->task_activity_id) === FALSE){
				$this->error = 'SI_InvoiceLineLink::getUnitPrice(): Error getting task activity: '.$ta->getLastError();
				return FALSE;	
			}
			
			return $ta->hourly_rate;
		}elseif($this->expense_id > 0){
			$ex = new SI_Expense();
			if($ex->get($this->expense_id) === FALSE){
				$this->error = 'SI_InvoiceLineLink::getPrice(): Error getting expense: '.$ex->getLastError();
				return FALSE;	
			}
			return $ex->price;
		}elseif($this->payment_schedule_id > 0){
			$ps = new SI_PaymentSchedule();
			if($ps->get($this->payment_schedule_id) === FALSE){
				$this->error = 'SI_InvoiceLineLink::getPrice(): Error getting scheduled payment: '.$ps->getLastError();
				return FALSE;	
			}
			return $ps->amount;
		}
		
		return 'Unknown';
	}