コード例 #1
0
ファイル: account.php プロジェクト: nanoprime/sureinvoice
require_once('includes/SI_Account.php');
$title = '';
$account = new SI_Account();

if($_REQUEST['mode'] == 'add'){
	$title = "Add Account";
	
	if($_POST['save']){
		$account->updateFromAssocArray($_POST);
		$account->id = $account->add();
		if($account->id !== false){
			goBack();
		}else{
			$error_msg .= "Error adding Account!\n";
			debug_message($account->getLastError());
		}
	}
}else if($_REQUEST['mode'] == 'edit'){
	$title = "Edit Account";
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
	}else{
		if(!$account->get($_REQUEST['id'])){
			$error_msg .= "Error retrieving account information!\n";
			debug_message($account->getLastError());
		}
	}

	if($_POST['save']){
		$account->updateFromAssocArray($_POST);
コード例 #2
0
ファイル: qb_export.php プロジェクト: nanoprime/sureinvoice
	$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());
	}
}elseif(strtolower($_REQUEST['mode']) == 'payment'){
	$payment = new SI_Payment();
	$output = $payment->exportQB();
	if($output === FALSE){
		fatal_error("Error getting payment export data!\n".$payment->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'invoice'){
	$invoice = new SI_Invoice();
	$output = $invoice->exportQB();
	if($output === FALSE){
		fatal_error("Error getting invoice export data!\n".$invoice->getLastError());
	}
}else{
	fatal_error("Unknown export mode!");
コード例 #3
0
ファイル: SI_Account.php プロジェクト: nanoprime/sureinvoice
	function importQB($data){
		global $db_conn;
		
		if(!isset($data['Account']) || count($data['Account']) == 0){
			return TRUE;
		}
		
		foreach($data['Account'] as $qb_account){
			$cur_accounts = $this->retrieveSet("WHERE name = '".$db_conn->escapeString($qb_account['NAME'])."'");
			if($cur_accounts === FALSE){
				$this->error = "SI_Account::import(): Error looking for account with name of {$qb_account['NAME']}";
				return FALSE;
			}
			$account = NULL;
			if(count($cur_accounts) != 1){
				// Not found or more than one found so just add a new one
				$account = new SI_Account();
			}else{
				$account =& $cur_accounts[0];	
			}

			$account->name = $qb_account['NAME'];
			$account->description = $qb_account['DESC'];
			$account->type = $qb_account['ACCNTTYPE'];
						
			$result = FALSE;
			if($account->id > 0){
				$result = $account->update();
			}else{
				$result = $account->add();
			}
			if($result === FALSE){
				$this->error = "SI_Account::importQB(): Error adding account: ".$account->getLastError();
				return FALSE;
			}
		}
		
		return TRUE;
	}