function get($id = NULL){ global $db_conn; if(!isset($id)){ $id = $this->id; } if(!isset($id)){ $this->error = "SI_SalesCommissionType::get() : SalesCommissionType id not set\n"; return FALSE; } $SalesCommissionType = SI_SalesCommissionType::retrieveSet("WHERE id = $id", TRUE); if($SalesCommissionType === FALSE){ return FALSE; } if(isset($SalesCommissionType[0])){ $this->_populateData($SalesCommissionType[0]); $this->stripSlashes(); }else{ $this->error = "SI_SalesCommissionType::get() : No data retrieved from query\n"; return FALSE; } return TRUE; }
<TD CLASS="form_field_cell"> <SELECT NAME="sales_com_user_id" CLASS="input_text" DISABLED> <OPTION VALUE="0">None</OPTION> <?php echo SI_User::getSelectTags($task->sales_com_user_id); ?> </SELECT> </TD> </TR> <TR> <TD CLASS="form_field_header_cell">Commission Type:</TD> <TD CLASS="form_field_cell"> <SELECT NAME="sales_com_type_id" CLASS="input_text" DISABLED> <OPTION VALUE="0">None</OPTION> <?php echo SI_SalesCommissionType::getSelectTags($task->sales_com_type_id); ?> </SELECT> </TD> </TR> <TR> <TD CLASS="form_field_header_cell">Task Billable?</TD> <TD CLASS="form_field_cell"> <INPUT NAME="billable" TYPE="radio" VALUE="D" <?php echo checked($task->billable, "D"); ?> >Default <INPUT NAME="billable" TYPE="radio" VALUE="Y" <?php echo checked($task->billable, "Y"); ?> >Yes
function getSalesCommissionType(){ if($this->_sct == FALSE){ $sct = new SI_SalesCommissionType(); if($this->sales_com == 'Y' && $this->sales_com_type_id > 0){ if($sct->get($this->sales_com_type_id) === FALSE){ $this->error = "SI_Project::getSalesCommissionType(): Error getting sales commission: ".$sct->getLastError(); return FALSE; } $this->_sct = $sct; }elseif($this->sales_com == 'N'){ $this->_sct = $sct; }else{ $this->error = "SI_Project::getSalesCommissionType(): Invalid sales commission setting: {$this->sales_com}"; return FALSE; } } return $this->_sct; }
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * */ require_once('includes/common.php'); require_once('includes/SI_User.php'); checkLogin("admin"); require_once('includes/SI_SalesCommissionType.php'); $com_type = new SI_SalesCommissionType(); $com_types = $com_type->retrieveSet("ORDER BY name"); if($com_types === FALSE){ $error_msg .= "Error getting commission types!\n"; debug_message($com_type->getLastError()); } $title = "Sales Commission Type Administration"; require('header.php') ?> <div class="tableContainer"> <a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"><img src="images/arrow_down.jpg" alt="Hide table" />Sales Commission Types</a><div> <div class="gridToolbar"> <a href="sales_comission_type.php?mode=add" style="background-image:url(images/new_invoice.png);">New Sales Commission Type</a> </div> <table border="0" cellspacing="0" cellpadding="0">
function _calcCommission(){ $task = $this->getTask(); if($task === FALSE) return FALSE; $amount = 0.00; if($this->sales_com_type_id > 0){ $task = $this->getTask(); if(!$task->isSpec() || ($task->isSpec() && $task->isCompleted())){ $sct = new SI_SalesCommissionType(); if($sct->get($this->sales_com_type_id) === FALSE){ $this->error = "SI_TaskActivity::_calcCommission(): Error getting sales commission type: ".$sct->getLastError(); return FALSE; } //debug_message("Found price of ".$this->price." and cost of ".$this->cost."\n"); $amount = round($sct->calculateCommission($this->price, $this->cost), 2); if($amount === FALSE){ $this->error = "SI_TaskActivity::_calcCommission(): Error calculating commission: ".$sct->getLastError(); return FALSE; } } } $this->com_amount = $amount; return TRUE; }
?> </a><div> <table border="0" cellspacing="0" cellpadding="0" class="form_table"> <tr> <td class="form_field_header_cell">Name:</td> <td class="form_field_cell"><input name="name" class="input_text" size="25" type="text" value="<?php echo $com_type->name; ?> "></td> </tr> <tr> <td class="form_field_header_cell">Commission Type:</td> <td class="form_field_cell"> <select name="type"> <?php echo SI_SalesCommissionType::getTypeSelectTags($com_type->type); ?> </select> </td> </tr> <tr> <td class="form_field_header_cell">Rate:</td> <td class="form_field_cell"><input name="rate" class="input_text" size="35" type="text" value="<?php echo $com_type->rate; ?> "></td> </tr> <tr> <td colspan="2" class="form_field_cell"> <div align="right"><input type="submit" class="button" name="save" value="Save"></div> </td>