* http://www.gnu.org/copyleft/gpl.html * */ require_once('includes/common.php'); require_once('includes/SI_Payment.php'); require_once('includes/SI_CompanyTransaction.php'); require_once('includes/SI_CCProcessor.php'); checkLogin(); if($loggedin_user->hasRight('accounting') && !empty($_REQUEST['company_id'])){ $company_id = $_REQUEST['company_id']; }else{ $company_id = $loggedin_user->company_id; } $company = new SI_Company(); if($company->get($company_id) === FALSE){ fatal_error("Could not get company for id $company_id"); } $invoice = new SI_Invoice(); if($invoice->get($_REQUEST['invoice_id']) === FALSE){ fatal_error("Could not get invoice {$_REQUEST['invoice_id']}\n"); } $payment = new SI_Payment(); $payment->company_id = $company_id; $title = "Add Payment"; if($_POST['save']){ $payment->amount = preg_replace('/[^0-9\.]/','', $_POST['amount']); if($payment->amount > $invoice->getTotal()){
echo "****ERR: Could not retreive unbilled expenses! ****\n"; debug_message($expense->getLastError()); } elseif (count($expenses) > 0) { foreach ($expenses as $exp) { $comp_ids[] = $exp->getCompany()->id; echo " * " . $exp->getCompany()->id . " \n"; } } echo "\n\n\$\$\$\$ START MAKIN MONEY \$\$\$\$\n\n"; $comp_ids = array_unique($comp_ids); if (count($comp_ids) > 0) { foreach ($comp_ids as $compid) { echo "\$\$\$ Generating Invoice for Company_id - {$compid}\n"; $invoice = new SI_Invoice(); $company = new SI_Company(); if ($company->get($compid)) { $company_array = get_object_vars($company); $company_array['company_id'] = $company->id; unset($company_array['id']); } $invoice->updateFromAssocArray($company_array); if ($invoice->add() !== FALSE) { $activity = new SI_TaskActivity(); $temp_array = $activity->getActivitiesForCompany($compid); if ($temp_array != NULL) { $ta_ids = ''; foreach ($temp_array as $temptask) { $ta_ids[] = $temptask->id; } $ta_ids = array_unique($ta_ids); }
if($_POST['save']){ $company->updateFromAssocArray($_POST); if($company->add() !== false){ goBack(); }else{ $error_msg .= "Error adding Company!\n"; debug_message($company->getLastError()); } } }else if($_REQUEST['mode'] == 'edit'){ $title = "Edit Company"; if(empty($_REQUEST['id'])){ $error_msg .= "Error: No ID specified!\n"; }else{ if(!$company->get($_REQUEST['id'])){ $error_msg .= "Error retrieving company information!\n"; debug_message($company->getLastError()); } } if($_POST['save']){ $company->updateFromAssocArray($_POST); if($company->update()){ goBack(); }else{ $error_msg .= "Error updating Company!\n"; debug_message($company->getLastError()); } } }else if($_REQUEST['mode'] == 'delete'){
*/ require_once('includes/common.php'); require_once('includes/SI_Company.php'); checkLogin(); $title = ''; $company = new SI_Company(); $title = "Edit Company"; if($loggedin_user->isDeveloper() && !empty($_REQUEST['id'])){ $id = $_REQUEST['id']; }else{ $id = $loggedin_user->company_id; } if(!$company->get($id)){ $error_msg .= "Error retrieving company information!\n"; debug_message($company->getLastError()); } if($_POST['save']){ $company->updateFromAssocArray($_POST); if($company->update()){ goBack(); }else{ $error_msg .= "Error updating Company!\n"; debug_message($company->getLastError()); } } ?> <? require('header.php'); ?>
function getCompany(){ if($this->_company == FALSE && $this->company_id > 0){ $company = new SI_Company(); if($company->get($this->company_id) === FALSE){ $this->error = "SI_Project::getCompany(): Error getting company: ".$company->getLastError(); return FALSE; } $this->_company =& $company; } return $this->_company; }
function getMyCompany() { $company = new SI_Company(); if (isset($GLOBALS['CONFIG']['my_company_id']) && $GLOBALS['CONFIG']['my_company_id'] > 0) { $company->get($GLOBALS['CONFIG']['my_company_id']); } return $company; }
require_once('includes/SI_Payment.php'); checkLogin('accounting'); if(intval($_REQUEST['id']) == 0){ fatal_error("You must provide an invoice id to edit!"); } $invoice = new SI_Invoice(); if($invoice->get(intval($_REQUEST['id'])) === FALSE){ $error_msg .= "Error retreiving invoice information!\n"; debug_message($invoice->getLastError()); } $company = new SI_Company(); if($company->get($invoice->company_id) === FALSE){ $error_msg .= "Error retreiving company information!\n"; debug_message($company->getLastError()); } if(isset($_POST['save_top'])){ $old_invoice = $invoice; $timestamp = getTSFromInput($_POST['timestamp']); $_POST['timestamp'] = $timestamp; $invoice->updateFromAssocArray($_POST); if($invoice->update() === FALSE){ $error_msg .= "Error updating invoice information!"; debug_message($invoice->getLastError()); }else{ //Add discount line
} } if($expense->task_id > 0){ if($task->get($expense->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()); } if($company->get($project->company_id) === FALSE){ $error_msg .= "Error getting company information!\n"; debug_message($company->getLastError()); } }elseif($expense->project_id > 0){ if($project->get($expense->project_id) === FALSE){ $error_msg .= "Error getting project information!\n"; debug_message($project->getLastError()); } if($company->get($project->company_id) === FALSE){ $error_msg .= "Error getting company information!\n"; debug_message($company->getLastError()); } }else{ if($company->get($expense->company_id) === FALSE){
function getName(){ $company = new SI_Company(); if($company->get($this->company_id) === FALSE){ $this->error = "SI_Invoice::getName(): Error getting company: ".$company->getLastError(); return ""; } return $company->name; }
goBack(); } }else{ $error_msg .= "Error adding Invoice!\n"; debug_message($invoice->getLastError()); } } } $_REQUEST['detail'] = strtolower(substr($_REQUEST['detail'],0,1)) == "y" ? TRUE : FALSE; $company = new SI_Company(); $title = "Create Invoice"; $total_time = 0; if(isset($_REQUEST['company_id']) && $_REQUEST['company_id'] > 0){ if($company->get($_REQUEST['company_id']) === FALSE){ $error_msg .= "Could not retrieve information for Company ID ".$_REQUEST['company_id']."!\n"; debug_message($company->getLastError()); } $activities = $activity->getActivitiesForCompany($_REQUEST['company_id']); if($activities === FALSE){ $error_msg .= "Could not retrieve Activity List for Company ID ".$_REQUEST['company_id']."!\n"; debug_message($activity->getLastError()); } $items = $ps->getForCompany($_REQUEST['company_id']); if($items === FALSE){ $error_msg .= "Could not retrieve scheduled payments for Company ID ".$_REQUEST['company_id']."!\n"; debug_message($ps->getLastError()); }