Ejemplo n.º 1
0
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 (count($ta_ids) > 0) {
                if ($invoice->addTaskActivities($ta_ids, SI_ACTIVITY_AGGREGATION_TASK) === FALSE) {
                    $error_msg .= "Error adding activities to invoice!\n";
                    debug_message($invoice->getLastError());
                }
            }
            $ps = new SI_PaymentSchedule();
            $ps_array = $ps->getForCompany($compid);
Ejemplo n.º 2
0
				if($ct->update() === FALSE){
					$error_msg .= "Error updating company transaction with new price";
					debug_message($ct->getLastError());	
				}else{
					header('Location: '.getCurrentURL('invoice_edit.php').'?id='.$invoice->id."\r\n");
					die();
				}	
			}
			
		}
	}	
}

$activity = new SI_TaskActivity();
$ps = new SI_PaymentSchedule();
$activities = $activity->getActivitiesForCompany($invoice->company_id, true, 0, true);
if($activities === FALSE){
	$error_msg .= "Could not retrieve Activity List for Company!\n";
	debug_message($activity->getLastError());
}

$items = $ps->getForCompany($invoice->company_id);
if($items === FALSE){
	$error_msg .= "Could not retrieve scheduled payments for Company!\n";
	debug_message($ps->getLastError());
}

$expenses = $company->getExpenses(TRUE);
if($expenses === FALSE){
	$error_msg .= "Could not retrieve expenses for Company!\n";
	debug_message($company->getLastError());
Ejemplo n.º 3
0
$activity = new SI_TaskActivity();
$_REQUEST['detail'] = strtolower(substr($_REQUEST['detail'],0,1)) == "y" ? TRUE : FALSE;

if($_REQUEST['company_id']){
	if(!$loggedin_user->hasRight('admin') && !$loggedin_user->hasRight('accounting')){
		if($loggedin_user->company_id != $_REQUEST['company_id']){
			fatal_error('You do not have access to view this company!');
		}
	}
	$title = "for Company";
	$field_header = 'Billed';
	$field = 'invoice_id';
	$url = $_SERVER['PHP_SELF']."?company_id=".$_REQUEST['company_id']."&unbilled=".$_REQUEST['unbilled']."&";
	$_REQUEST['unbilled'] = strtolower(substr($_REQUEST['unbilled'],0,1)) == "y" ? TRUE : FALSE;
	$activities = $activity->getActivitiesForCompany($_REQUEST['company_id'], $_REQUEST['unbilled']);
	if($activities === FALSE){
		$error_msg .= "Could not retrieve Activity List for Company ID ".$_REQUEST['company_id']."!\n";
		debug_message($activity->getLastError());
	}
}else if($_REQUEST['invoice']){
	$title = "for Invoice Number ".$_REQUEST['invoice'];
	$field_header = 'Billed';
	$field = 'invoice';
	$url = $_SERVER['PHP_SELF']."?invoice=".$_REQUEST['invoice']."&";
	$invoice = new SI_Invoice();
	if($invoice->get($_REQUEST['invoice']) === FALSE){
		$error_msg .= "Could not find invoice!\n";
		debug_message($invoice->getLastError());
	}
	
Ejemplo n.º 4
0
		}
	}
}

$_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());
	}
	
	$expenses = $company->getExpenses(TRUE);
	if($expenses === FALSE){
		$error_msg .= "Could not retrieve expenses for Company ID ".$_REQUEST['company_id']."!\n";
		debug_message($company->getLastError());