Exemplo n.º 1
0
checkLogin();

$SI_SYSTEM_DEFAULTS = new SimpleInvoices_Db_Table_SystemDefaults();
$SI_CUSTOMERS = new SimpleInvoices_Db_Table_Customers();
$SI_INVOICE_TYPE = new SimpleInvoices_Db_Table_InvoiceType();
$SI_BILLER = new SimpleInvoices_Db_Table_Biller();
$SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();
$SI_CUSTOM_FIELDS = new SimpleInvoices_Db_Table_CustomFields();

#get the invoice id
$invoice_id = $_GET['invoice'];


$invoice = getInvoice($invoice_id);
$invoice_type = $SI_INVOICE_TYPE->getInvoiceType($invoice['type_id']);
$customer = $SI_CUSTOMERS->getCustomerById($invoice['customer_id']);
$biller = $SI_BILLER->getBiller($invoice['biller_id']);
$preference = $SI_PREFERENCES->getPreferenceById($invoice['preference_id']);
$defaults = $SI_SYSTEM_DEFAULTS->fetchAll();
$invoiceItems = matrix_invoice::getInvoiceItems($invoice_id);

#Invoice Age - number of days - start
if ($invoice['owing'] > 0 ) {
    $invoice_age_days =  number_format((strtotime(date('Y-m-d')) - strtotime($invoice['calc_date'])) / (60 * 60 * 24),0);
	$invoice_age = "$invoice_age_days {$LANG['days']}";
}
else {
    $invoice_age ="";
}

	$url_for_pdf = "./pdfmaker.php?id=" . $invoice['id'];
Exemplo n.º 2
0
 /**
  * Initializes invoice data.
  * This method is equivalent to the old getInvoice()
  */
 protected function _initData()
 {
     $customers = new SimpleInvoices_Db_Table_Customers();
     $this->_data = $customers->getCustomerById($this->_id);
     unset($this->_data['id']);
 }
	$invoices = $invoice_all->fetchAll();

	foreach ($invoices as $i => $row) {
		$statement['total'] = $statement['total'] + $row['invoice_total'];
		$statement['owing'] = $statement['owing'] + $row['owing'] ;
		$statement['paid'] = $statement['paid'] + $row['INV_PAID'];
		
	}
}

$sql = "select DISTINCT(custom_field3) from  " . TB_PREFIX . "invoices where custom_field3 != ''";
$cf3 = $db->query($sql);

$biller_details = $SI_BILLER->getBiller($biller_id);
$customer_details = $SI_CUSTOMERS->getCustomerById($customer_id);
$smarty -> assign('biller_id', $biller_id);
$smarty -> assign('biller_details', $biller_details);
$smarty -> assign('customer_id', $customer_id);
$smarty -> assign('customer_details', $customer_details);
$smarty -> assign('cf3', $cf3->fetchAll());
$smarty -> assign('custom_field3', $custom_field3);

$smarty -> assign('filter_by_date', $filter_by_date);


$smarty -> assign('invoices', $invoices);
$smarty -> assign('statement', $statement);
$smarty -> assign('start_date', $start_date);
$smarty -> assign('end_date', $end_date);
Exemplo n.º 4
0
*
* Website:
* 	http://www.simpleinvoices.org
 */
#table

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();

$SI_SYSTEM_DEFAULTS = new SimpleInvoices_Db_Table_SystemDefaults();
$SI_CUSTOMERS = new SimpleInvoices_Db_Table_Customers();

#get the invoice id
$defaults = $SI_SYSTEM_DEFAULTS->fetchAll();
$master_customer_id = $_GET['customer_id'];
$customer = $SI_CUSTOMERS->getCustomerById($master_customer_id);

if ($_GET['action'] == 'update_template') {	/* update default template for customer */

 $sql = "UPDATE ".TB_PREFIX."customers SET custom_field4 = :cf4 WHERE id = :id";
 dbQuery($sql,
	':cf4', $_GET['id'],
 	':id', $master_customer_id
	);

 $smarty -> assign("view","quick_view");
 $smarty -> assign("spec","id");
 $smarty -> assign("id",$_GET['id']);
# print("debug=$sql");
} else {