require_once('includes/SI_TaskActivity.php'); 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{
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; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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'); checkLogin('admin'); require_once('includes/SI_Company.php'); require_once('includes/SI_RateStructure.php'); $title = ''; $company = new SI_Company(); if($_REQUEST['mode'] == 'add'){ $title = "Add Company"; 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($invoices === FALSE){ $error_msg .= "Error getting invoices updated since ".date('m-d-Y', $last_update_ts); debug_message($invoice->getLastError()); } $payment = new SI_Payment(); $payments = $payment->retrieveSet("WHERE updated_ts > $last_update_ts"); if($payments === FALSE){ $error_msg .= "Error getting invoices updated since ".date('m-d-Y', $last_update_ts); debug_message($payment->getLastError()); } if(isset($_POST['save2'])){ $output = ''; if(isset($_POST['export_companies']) && is_array($_POST['export_companies'])){ $company = new SI_Company(); $company_output = $company->exportQB("WHERE id IN (".join(',', $_POST['export_companies']).")"); if($company_output === FALSE){ fatal_error("Error getting company export data!\n".$company->getLastError()); }else{ $output .= $company_output; } } if(isset($_POST['export_item_codes']) && is_array($_POST['export_item_codes'])){ $item_code = new SI_ItemCode(); $item_code_output = $item_code->exportQB("WHERE id IN (".join(',', $_POST['export_item_codes']).")"); if($item_code_output === FALSE){ fatal_error("Error getting item_code export data!\n".$item_code->getLastError()); }else{ $output .= $item_code_output;
<img src="images/arrow_down.jpg" alt="Hide table" />SureInvoice Configuration</a><div> <table border="0" cellspacing="0" cellpadding="0" class="dg_table"> <tr> <th colspan="3">General</th> </tr> <tr> <td class="dg_data_cell_1">My Company</td> <td class="dg_data_cell_1">Select the company entry for your company. The details from this company will be used on invoices.</td> <td class="dg_data_cell_1"> <select name="params[my_company_id]" <?php echo !SI_Config::canEdit('my_company_id') ? 'DISABLED' : ''; ?> > <option value="0">Select company...</option> <?php echo SI_Company::getSelectTags($GLOBALS['CONFIG']['my_company_id']); ?> </select> </td> </tr> <tr> <td class="dg_data_cell_1">Currency Symbol</td> <td class="dg_data_cell_1">The currency symbol to use in the application</td> <td class="dg_data_cell_1"> <select name="params[currency_symbol]" class="input_text" <?php echo !SI_Config::canEdit('currency_symbol') ? 'DISABLED' : ''; ?> > <?php echo SI_Config::getCurrencySymbolSelectTags(); ?>
?> "></td> </tr> <tr> <td class="form_field_header_cell">Last Name:</td> <td class="form_field_cell"><input name="last_name" class="input_text" size="25" type="text" value="<?php echo $user->last_name; ?> "></td> </tr> <tr> <td class="form_field_header_cell">Company:</td> <td class="form_field_cell"> <select name="company_id" class="input_text"> <?php echo SI_Company::getSelectTags($user->company_id); ?> </select> </td> </tr> <tr> <td class="form_field_header_cell">Address Line 1:</td> <td class="form_field_cell"><input name="address1" class="input_text" size="35" type="text" value="<?php echo $user->address1; ?> "></td> </tr> <tr> <td class="form_field_header_cell">Address Line 2:</td> <td class="form_field_cell"><input name="address2" class="input_text" size="35" type="text" value="<?php echo $user->address2;
* 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_Company.php'); $company = new SI_Company(); $companies = $company->retrieveSet("WHERE deleted = 'N' ORDER BY name"); if($companies === FALSE){ $error_msg .= "Error getting companies!\n"; debug_message($company->getLastError()); } $title = "Company Administration"; require('header.php') ?> <div class="tableContainer"> <a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"><img src="images/arrow_down.jpg" alt="Hide table" />Companies</a> <div> <div class="gridToolbar"> <a href="company.php?mode=add" style="background-image:url(images/new_invoice.png);">New Company</a> </div>
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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_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);
* */ require_once('includes/common.php'); require_once('includes/SI_Project.php'); require_once('includes/SI_Company.php'); require_once('includes/SI_Invoice.php'); checkLogin(); $project = new SI_Project(); if($loggedin_user->hasRight('accounting') && !empty($_REQUEST['id'])){ $id = $_REQUEST['id']; }else{ $id = $loggedin_user->company_id; } $company = new SI_Company(); if($company->get($id) === FALSE){ $error_msg .= "Could not retrieve data for company!\n"; debug_message($company->getLastError()); } $balance = $company->getBalance(); if($balance === FALSE){ $error_msg .= "Error getting your outstanding balance!"; debug_message($company->getLastError()); } $invoice = new SI_Invoice(); $invoices = $invoice->getForCompany($company->id); if($invoices === FALSE){ $error_msg .= "Could not retrieve Invoice list!\n";
<?}else{?> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="form_table"> <TR> <TD CLASS="form_field_header_cell">Date:</TD> <TD CLASS="form_field_cell"> <input type="text" class="input_text" name="timestamp" id="timestamp" SIZE="10" value="<?php echo $payment->timestamp > 0 ? date("n/j/Y", $payment->timestamp) : ''; ?> "> <a href="javascript:;" onclick="Uversa.SureInvoice.Calendar.show('timestamp')"><img width="16" height="16" border="0" src="images/dynCalendar.gif"/></a> </TD> </TR> <TR> <TD CLASS="form_field_header_cell">Company:</TD> <TD CLASS="form_field_cell"><?php echo SI_Company::getName($payment->company_id); ?> </TD> </TR> <TR> <TD CLASS="form_field_header_cell">Payment Type:</TD> <TD CLASS="form_field_cell"> <SELECT NAME="type" CLASS="input_text"> <?php echo SI_Payment::getTypeSelectTags($payment->type); ?> </SELECT> </TD> </TR> <TR> <TD CLASS="form_field_header_cell">Amount:</TD>
* http://www.gnu.org/copyleft/gpl.html * */ require_once('includes/common.php'); require_once('includes/SI_Invoice.php'); require_once('includes/SI_InvoiceLine.php'); require_once('includes/SI_Company.php'); require_once('includes/SI_TaskActivity.php'); require_once('includes/SI_Payment.php'); require_once('includes/SI_ItemCode.php'); checkLogin('accounting'); $line = new SI_InvoiceLine(); $invoice = new SI_Invoice(); $company = new SI_Company(); $item_code = new SI_ItemCode(); if(!isset($_REQUEST['mode'])) $_REQUEST['mode'] = 'add'; // Clean up unit_price if(!empty($_POST['unit_price'])){ $_POST['unit_price'] = preg_replace('/[^0-9\.-]/','',$_POST['unit_price']); } // Prepare our variables $line_added = false; if($_REQUEST['mode'] == 'add_ta_link' || $_REQUEST['mode'] == 'add_sp_link' || $_REQUEST['mode'] == 'add_ex_link' || $_REQUEST['mode'] == 'delete_link' || $_REQUEST['mode'] == 'edit' || $_REQUEST['mode'] == 'delete'){ if($_REQUEST['mode'] != 'delete' && intval($_REQUEST['id']) == 0 && intval($_REQUEST['invoice_id']) != 0){
require_once('includes/SI_Project.php'); require_once('includes/SI_Company.php'); require_once('includes/SI_Invoice.php'); require_once('includes/SI_ItemCode.php'); checkLogin(); $item_code = new SI_ItemCode(); $project = new SI_Project(); if($loggedin_user->isDeveloper() && !empty($_REQUEST['id'])){ $id = $_REQUEST['id']; }else{ $id = $loggedin_user->company_id; } $company = new SI_Company(); if($company->get($id) === FALSE){ $error_msg .= "Could not retrieve data for company!\n"; debug_message($company->getLastError()); } $balance = $company->getBalance(); if($balance === FALSE){ $error_msg .= "Error getting your outstanding balance!"; debug_message($company->getLastError()); } $transactions = $company->getTransactions(NULL, 5); if($transactions === FALSE){ $error_msg .= "Error getting transactions for company!\n"; debug_message($company->getLastError());
?> " METHOD="GET"> <div class="tableContainer"> <a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"><img src="images/arrow_down.jpg" alt="Hide table" /><?php echo $title; ?> </a><div> <table border="0" cellspacing="0" cellpadding="0" class="form_table"> <tr> <td class="form_field_header_cell">Company:</td> <td class="form_field_cell"> <? if($loggedin_user->hasRight('admin') || $loggedin_user->isDeveloper()){?> <select name="company_id" class="input_text"> <option value="0">All</option> <?php echo SI_Company::getSelectTags($_REQUEST['company_id']); ?> </select> <? }else{ ?> <input name="company_id" type="hidden" value="<?php echo $loggedin_user->company_id; ?> "> <?php echo $loggedin_user->company; ?> <? } ?> </td> </tr> <tr> <td class="form_field_header_cell">Resource:</td>
<div class="tableContainer"> <a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"> <img src="images/arrow_down.jpg" alt="Hide table" />Create New Project</a> <div> <form name="project" action="<?php echo $_SERVER['PHP_SELF']; ?> " METHOD="POST" ENCTYPE="multipart/form-data"> <table border="0" cellspacing="0" cellpadding="0" class="form_table"> <tr> <td class="form_field_header_cell">Company:</td> <td class="form_field_cell"> <select name="company_id" class="input_text" tabindex="1"> <option value="0">None</option> <?php echo SI_Company::getSelectTags($project->company_id); ?> </select> </td> </tr> <tr> <td class="form_field_header_cell">Project Name:</td> <td class="form_field_cell"><input name="name" tabindex="2" class="input_text" size="45" type="text" value=""></td> </tr> <tr> <td class="form_field_header_cell">Project Status:</td> <td class="form_field_cell"> <select name="project_status_id" class="input_text" tabindex="3"> <?php echo SI_ProjectStatus::getSelectTags(); ?>
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; }
* http://www.gnu.org/copyleft/gpl.html * */ require_once('includes/common.php'); require_once('includes/SI_Company.php'); require_once('includes/SI_ItemCode.php'); require_once('includes/SI_Account.php'); require_once('includes/SI_Payment.php'); require_once('includes/SI_Invoice.php'); checkLogin(); if(!isset($_REQUEST['mode']) || empty($_REQUEST['mode'])){ fatal_error("Export mode must be specified!"); }elseif(strtolower($_REQUEST['mode']) == 'company'){ $company = new SI_Company(); $output = $company->exportQB(); if($output === FALSE){ fatal_error("Error getting company export data!\n".$company->getLastError()); } }elseif(strtolower($_REQUEST['mode']) == 'item_code'){ $code = new SI_ItemCode(); $output = $code->exportQB(); if($output === FALSE){ fatal_error("Error getting item code export data!\n".$code->getLastError()); } }elseif(strtolower($_REQUEST['mode']) == 'account'){ $account = new SI_Account(); $output = $account->exportQB(); if($output === FALSE){ fatal_error("Error getting account export data!\n".$account->getLastError());
$projects = $project->getMyProjects($user_id, TRUE); } if($projects === FALSE){ $error_msg .= "Could not retrieve your project list!\n"; debug_message($project->getLastError()); } $task = new SI_Task(); $tasks = $task->getUpcoming($user_id); if($tasks === FALSE){ $error_msg .= "Could not retrieve Upcoming Tasks!\n"; debug_message($task->getLastError()); } $company = new SI_Company(); $companies = $company->getCompanysWithBalance(); if($companies === FALSE){ $error_msg .= "Could not retrieve Outstanding Hours list!\n"; debug_message($company->getLastError()); } $user = new SI_User(); $users = $user->getUnpaidUsers(); if($users === FALSE){ $error_msg .= "Could not retrieve Unpaid Users's list!\n"; debug_message($user->getLastError()); } $title = "My Projects";
* 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_Project.php'); require_once('includes/SI_Company.php'); require_once('includes/SI_Task.php'); require_once('includes/SI_Invoice.php'); require_once('includes/SI_Check.php'); checkLogin('accounting'); $project = new SI_Project(); $company = new SI_Company(); $companies = $company->getCompanysWithUnbilledAmount(); if($companies === FALSE){ $error_msg .= "Could not retrieve Outstanding Hours list!\n"; debug_message($company->getLastError()); } $user = new SI_User(); $users = $user->getUnpaidUsers(); if($users === FALSE){ $error_msg .= "Could not retrieve Unpaid Users's list!\n"; debug_message($user->getLastError()); } $invoice = new SI_Invoice(); $invoices = $invoice->getOutstanding();
$title = 'Import From Quickbooks'; if($_POST['save']){ $importer = new QBImporter(); $dest_file = '/tmp/'.basename($_FILES['iif_file']['name']); if(!move_uploaded_file($_FILES['iif_file']['tmp_name'], $dest_file)){ $error_msg .= "Could not move uploaded file!"; }else{ $data = $importer->import($dest_file); if($data === FALSE){ $error_msg .= "Error importing file!"; debug_message($importer->getLastError()); } $company = new SI_Company(); if($company->importQB($data) === FALSE){ $error_msg .= "Error importing company data!"; debug_message($company->getLastError()); } $code = new SI_ItemCode(); if($code->importQB($data) === FALSE){ $error_msg .= "Error importing item code data!"; debug_message($code->getLastError()); } $account = new SI_Account(); if($account->importQB($data) === FALSE){ $error_msg .= "Error importing account data!"; debug_message($account->getLastError());
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; }
* 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_Expense.php'); require_once('includes/SI_CompanyTransaction.php'); require_once('includes/SI_Project.php'); require_once('includes/SI_Task.php'); require_once('includes/SI_ItemCode.php'); checkLogin('accounting'); $title = ''; $expense = new SI_Expense(); $company = new SI_Company(); $project = new SI_Project(); $task = new SI_Task(); $item_code = new SI_ItemCode(); // Clean up cost if(!empty($_POST['cost'])){ $_POST['cost'] = preg_replace('/[^0-9\.]/','', $_POST['cost']); } // Clean up price if(!empty($_POST['price'])){ $_POST['price'] = preg_replace('/[^0-9\.]/','', $_POST['price']); } if($_REQUEST['mode'] == 'add'){
if ($expenses === FALSE) { 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);
function soap_get_companies($username, $password) { $user = auth_user($username, $password); if ($user === FALSE) { return new soap_fault('Client', '', 'Access Denied'); } $company = new SI_Company(); $companies = $company->retrieveSet("WHERE deleted = 'N' ORDER BY name"); return object_to_data($companies, array('id', 'name')); }
* 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_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(empty($error_msg)){ 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']);