/**
  * Tests loading the CSystem_Bcode Object
  */
 public function testLoad()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $item = new CSystem_Bcode();
     $item->overrideDatabase($this->mockDB);
     $this->post_data['billingcode_id'] = $this->obj->billingcode_id;
     $this->mockDB->stageHash($this->post_data);
     $item->load($this->obj->billingcode_id);
     $this->assertEquals($this->obj->billingcode_id, $item->billingcode_id);
     $this->assertEquals($this->obj->billingcode_name, $item->billingcode_name);
     $this->assertEquals($this->obj->billingcode_desc, $item->billingcode_desc);
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     trigger_error("bcode has been deprecated in v3.0 and will be removed by v4.0. Please use CSystem_Bcode instead.", E_USER_NOTICE);
 }
?>
</th>
        <th width="10px" align="center"><?php 
echo $AppUI->_('Actual Cost');
?>
</th>
        <th width="10px" align="center"><?php 
echo $AppUI->_('Difference');
?>
</th>
    </tr>
    <?php 
//TODO: rotate the headers by 90 degrees?
$activeOnly = $active_projects ? true : false;
$projectList = CCompany::getProjects($AppUI, $company_id, $activeOnly);
$bcode = new CSystem_Bcode();
$project = new CProject();
if (count($projectList)) {
    foreach ($projectList as $projectItem) {
        $project->loadFull(null, $projectItem['project_id']);
        $criticalTasks = $project->getCriticalTasks($projectItem['project_id']);
        $costs = $bcode->calculateProjectCost($projectItem['project_id'], $start_date->format(FMT_DATETIME_MYSQL), $end_date->format(FMT_DATETIME_MYSQL));
        $pstart = new w2p_Utilities_Date($project->project_start_date);
        $pend = intval($criticalTasks[0]['task_end_date']) ? new w2p_Utilities_Date($criticalTasks[0]['task_end_date']) : new w2p_Utilities_Date();
        $filterStart = $start_date;
        $filterEnd = $end_date;
        $workingDaysInSpans = $filterStart->findDaysInRangeOverlap($pstart, $pend, $filterStart, $filterEnd);
        $workingDaysForProj = $pstart->workingDaysInSpan($pend);
        $factor = $workingDaysInSpans / $workingDaysForProj;
        $factor = $factor > 1 ? 1 : $factor;
        ?>
Example #4
0
                                            <td nowrap="nowrap" style="text-align: right; padding-left: 40px;">
                                                <?php 
echo $w2Pconfig['currency_symbol'];
?>
&nbsp;
                                                <?php 
echo formatCurrency($totalBudget, $AppUI->getPref('CURRENCYFORM'));
?>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td class="hilite">
                                    <table cellspacing="1" cellpadding="2" border="0" width="100%">
                                        <?php 
$bcode = new CSystem_Bcode();
$results = $bcode->calculateTaskCost($task_id);
foreach ($billingCategory as $id => $category) {
    ?>
                                            <tr>
                                                <td align="right" nowrap="nowrap">
                                                    <?php 
    echo $AppUI->_($category);
    ?>
                                                </td>
                                                <td nowrap="nowrap" style="text-align: right; padding-left: 40px;">
                                                    <?php 
    echo $w2Pconfig['currency_symbol'];
    ?>
&nbsp;
                                                    <?php 
Example #5
0
$log = new CTask_Log();
if ($task_log_id) {
    if (!$canEdit || !$canViewTask) {
        $AppUI->redirect('m=public&a=access_denied');
    }
    $log->load($task_log_id);
} else {
    if (!$canAdd || !$canViewTask) {
        $AppUI->redirect('m=public&a=access_denied');
    }
    $log->task_log_task = $obj->task_id;
    $log->task_log_name = $obj->task_name;
}
$project = new CProject();
$project->load($obj->task_project);
$bcode = new CSystem_Bcode();
$companyBC = $bcode->getBillingCodes($project->project_company);
$neutralBC = $bcode->getBillingCodes(0);
$taskLogReference = w2PgetSysVal('TaskLogReference');
$billingCategory = w2PgetSysVal('BudgetCategory');
// Task Update Form
$df = $AppUI->getPref('SHDATEFORMAT');
$log_date = new w2p_Utilities_Date($log->task_log_date);
?>

<!-- TIMER RELATED SCRIPTS -->
<script language="javascript" type="text/javascript">
	// please keep these lines on when you copy the source
	// made by: Nicolas - http://www.javascript-page.com
	// adapted by: Juan Carlos Gonzalez jcgonz@users.sourceforge.net
Example #6
0
?>
</th>
        <th width="10px" align="center"><?php 
echo $AppUI->_('Actual Cost');
?>
</th>
        <th width="10px" align="center"><?php 
echo $AppUI->_('Difference');
?>
</th>
    </tr>
    <?php 
//TODO: rotate the headers by 90 degrees?
$task = new CTask();
$taskList = $task->getAllowedTaskList(null, $project_id);
$bcode = new CSystem_Bcode();
if (count($taskList)) {
    foreach ($taskList as $taskItem) {
        $task->loadFull(null, $taskItem['task_id']);
        $costs = $bcode->calculateTaskCost($taskItem['task_id'], $start_date->format(FMT_DATETIME_MYSQL), $end_date->format(FMT_DATETIME_MYSQL));
        $tstart = new w2p_Utilities_Date($task->task_start_date);
        $tend = new w2p_Utilities_Date($task->task_end_date);
        $filterStart = $start_date;
        $filterEnd = $end_date;
        $workingDaysInSpans = $filterStart->findDaysInRangeOverlap($tstart, $tend, $filterStart, $filterEnd);
        $workingDaysForTask = $tstart->workingDaysInSpan($tend);
        $factor = $workingDaysInSpans / $workingDaysForTask;
        $factor = $factor > 1 ? 1 : $factor;
        ?>
<tr>
                <td align="center"><?php 
Example #7
0
                                            <td nowrap="nowrap" style="text-align: right; padding-left: 40px;">
                                                <?php 
    echo $w2Pconfig['currency_symbol'];
    ?>
&nbsp;
                                                <?php 
    echo formatCurrency($totalBudget, $AppUI->getPref('CURRENCYFORM'));
    ?>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td>
                                    <table cellspacing="1" cellpadding="2" border="0" width="100%">
                                        <?php 
    $bcode = new CSystem_Bcode();
    $results = $bcode->calculateProjectCost($project_id);
    foreach ($billingCategory as $id => $category) {
        ?>
                                            <tr>
                                                <td align="right" nowrap="nowrap">
                                                    <?php 
        echo $AppUI->_($category);
        ?>
                                                </td>
                                                <td nowrap="nowrap" style="text-align: right; padding-left: 40px;">
                                                    <?php 
        echo $w2Pconfig['currency_symbol'];
        ?>
&nbsp;
                                                    <?php 
Example #8
0
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$company_id = (int) w2PgetParam($_POST, 'company_id', -1);
$billingcode_id = (int) w2PgetParam($_GET, 'billingcode_id', 0);
if (!canEdit('system')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$bcode = new CSystem_Bcode();
$bcode->load($billingcode_id);
$billingcodes = $bcode->getBillingCodes($company_id, false);
// get a list of permitted companies
$company = new CCompany();
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('None specified')), $companies);
$companies = arrayMerge(array('-1' => $AppUI->_('All Codes')), $companies);
$billingCategory = w2PgetSysVal('BudgetCategory');
$billingCategory = arrayMerge(array('0' => $AppUI->_('None specified')), $billingCategory);
$titleBlock = new w2p_Theme_TitleBlock('Edit Billing Codes', 'myevo-weather.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=system', 'system admin');
$titleBlock->show();
?>
<script language="javascript" type="text/javascript">
<!--
function submitIt(){
	var form = document.frmAddcode;
	form.submit();
}
Example #9
0
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$obj = new CSystem_Bcode();
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
$action = $del ? 'deleted' : 'stored';
$result = $del ? $obj->delete() : $obj->store();
if (is_array($result)) {
    $AppUI->setMsg($result, UI_MSG_ERROR, true);
    $AppUI->holdObject($obj);
    $AppUI->redirect('m=system&a=billingcode');
}
if ($result) {
    $AppUI->setMsg('Billing Codes ' . $action, UI_MSG_OK, true);
    $AppUI->redirect('m=system&a=billingcode');
} else {
    $AppUI->redirect('m=public&a=access_denied');
}