示例#1
0
 public static function update()
 {
     global $db;
     global $auth_session;
     $sql = "UPDATE\n            " . TB_PREFIX . "expense\n                SET\n                    amount = :amount,\n                    expense_account_id = :expense_account_id,\n                    biller_id = :biller_id,\n                    customer_id = :customer_id,\n                    invoice_id = :invoice_id,\n                    product_id = :product_id,\n                    date = :date,\n                    status = :status,\n                    note = :note\n                WHERE\n                    id = :id\n                    AND\n                    domain_id = :domain_id\n            ";
     $db->query($sql, ':id', $_POST['id'], ':domain_id', $auth_session->domain_id, ':amount', $_POST['amount'], ':expense_account_id', $_POST['expense_account_id'], ':biller_id', $_POST['biller_id'], ':invoice_id', $_POST['invoice_id'], ':product_id', $_POST['product_id'], ':customer_id', $_POST['customer_id'], ':date', $_POST['date'], ':status', $_POST['status'], ':note', $_POST['note']);
     expense::expense_item_tax($_POST['id'], $_POST['tax_id'][0], $_POST['amount'], "1", "update");
     return true;
 }
示例#2
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
# Deal with op and add some basic sanity checking
$op = !empty($_POST['op']) ? addslashes($_POST['op']) : NULL;
#insert product
$saved = false;
$expenseobj = new expense();
if ($op === 'add') {
    if ($expenseobj->save()) {
        $saved = true;
    }
}
if ($op === 'edit') {
    if ($expenseobj->update()) {
        $saved = true;
    }
}
$refresh_total = isset($refresh_total) ? $refresh_total : '&nbsp';
$smarty->assign('saved', $saved);
$smarty->assign('pageActive', 'product_manage');
$smarty->assign('active_tab', '#product');
示例#3
0
<?php
//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_TAX = new SimpleInvoices_Db_Table_Tax();

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

$expense = expense::get($expense_id);
$detail = expense::detail();
$detail['customer'] = customer::get($expense['customer_id']);
$detail['biller'] = biller::select($expense['biller_id']);
$detail['invoice'] = invoice::select($expense['invoice_id']);
$detail['product'] = product::get($expense['product_id']);
$detail['expense_account'] = expenseaccount::select($expense['expense_account_id']);
$detail['expense_tax'] = expensetax::get_all($expense_id);
$detail['expense_tax_total'] = $expense['amount'] + expensetax::get_sum($expense_id);
$detail['expense_tax_grouped'] = expensetax::grouped($expense_id);
$detail['status_wording'] = $expense['status']==1?$LANG['paid']:$LANG['not_paid'];

$taxes = $SI_TAX->fetchAllActive();
#$tax_selected = getTaxRate($product['default_tax_id']);
$defaults = $SI_SYSTEM_DEFAULTS->fetchAll();

$smarty -> assign('expense',$expense);
$smarty -> assign('detail',$detail);
$smarty -> assign('taxes',$taxes);
$smarty -> assign('defaults',$defaults);
$smarty -> assign('tax_selected',$tax_selected);
示例#4
0
<?php

//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_TAX = new SimpleInvoices_Db_Table_Tax();

$expense_add = expense::add();

$defaults = $SI_SYSTEM_DEFAULTS->fetchAll();

$taxes = $SI_TAX->fetchAllActive();

//if valid then do save
if ($_POST['expense_account_id'] != "" ) {
	include("sys/extensions/expense/modules/expense/save.php");
}

$smarty -> assign('save',$save);
$smarty -> assign('taxes',$taxes);
$smarty -> assign('expense_add',$expense_add);
$smarty -> assign('defaults',$defaults);

$smarty -> assign('pageActive', 'expense');
$smarty -> assign('subPageActive', 'add');
$smarty -> assign('active_tab', '#money');
?>
示例#5
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
$expenseobj = new expense();
$expense_add = $expenseobj->add();
$defaults = getSystemDefaults();
$taxes = getActiveTaxes();
//if valid then do save
if ($_POST['expense_account_id'] != "") {
    include "./extensions/expense/modules/expense/save.php";
}
$defaults = getSystemDefaults();
$smarty->assign('save', $save);
$smarty->assign('taxes', $taxes);
$smarty->assign('expense_add', $expense_add);
$smarty->assign('defaults', $defaults);
$smarty->assign('pageActive', 'expense');
$smarty->assign('subPageActive', 'add');
$smarty->assign('active_tab', '#money');
示例#6
0
<?php

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

$number_of_rows  = expense::count();

$smarty -> assign("number_of_rows",$number_of_rows);
if(isset($_GET['query']))
{
    $where = "&query=".$_GET['query']."&qtype=".$_GET['qtype'];
}
$url = "index.php?module=expense&view=xml".$where ;

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

$smarty -> assign('pageActive', 'expense');
$smarty -> assign('active_tab', '#money');
?>
示例#7
0
if (  $op === 'add' ) 
{
	
	if( expense::save() ) 
    {

 		$saved = true;

 	}

}

if ($op === 'edit') 
{

	if ( expense::update() ) 
    {

		$saved = true;

	}

}

$refresh_total = isset($refresh_total) ? $refresh_total : '&nbsp';

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

$smarty -> assign('pageActive', 'product_manage');
$smarty -> assign('active_tab', '#product');
?>
示例#8
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
$expenseobj = new expense();
$number_of_rows = $expenseobj->count();
$smarty->assign("number_of_rows", $number_of_rows);
if (isset($_GET['query'])) {
    $where = "&query=" . $_GET['query'] . "&qtype=" . $_GET['qtype'];
}
$url = "index.php?module=expense&view=xml" . $where;
$smarty->assign('url', $url);
$smarty->assign('pageActive', 'expense');
$smarty->assign('active_tab', '#money');
示例#9
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
#get the invoice id
$expense_id = $_GET['id'];
$expenseobj = new expense();
$customerobj = new customer();
$billerobj = new biller();
$invoiceobj = new invoice();
$productobj = new product();
$expenseaccountobj = new expenseaccount();
$expensetaxobj = new expensetax();
$expense = $expenseobj->get($expense_id);
$detail = $expenseobj->detail();
$detail['customer'] = $customerobj->get($expense['customer_id']);
$detail['biller'] = $billerobj->select($expense['biller_id']);
$detail['invoice'] = $invoiceobj->select($expense['invoice_id']);
$detail['product'] = $productobj->get($expense['product_id']);
$detail['expense_account'] = $expenseaccountobj->select($expense['expense_account_id']);
$detail['expense_tax'] = $expensetaxobj->get_all($expense_id);
$detail['expense_tax_total'] = $expense['amount'] + $expensetaxobj->get_sum($expense_id);
$detail['expense_tax_grouped'] = $expensetaxobj->grouped($expense_id);
$detail['status_wording'] = $expense['status'] == 1 ? $LANG['paid'] : $LANG['not_paid'];
$taxes = getActiveTaxes();
#$tax_selected = getTaxRate($product['default_tax_id']);
$defaults = getSystemDefaults();
$smarty->assign('expense', $expense);
$smarty->assign('detail', $detail);
$smarty->assign('taxes', $taxes);
$smarty->assign('defaults', $defaults);
示例#10
0
    public static function update()
    {

        global $db;
        global $auth_session;
        
        $sql = "UPDATE
            ".TB_PREFIX."expense
                SET
                    amount = :amount,
                    expense_account_id = :expense_account_id,
                    biller_id = :biller_id,
                    customer_id = :customer_id,
                    invoice_id = :invoice_id,
                    product_id = :product_id,
                    date = :date,
                    status = :status,
                    note = :note
                WHERE
                    id = :id
                    AND
                    domain_id = :domain_id
            ";

        $db->query($sql,
            ':id',$_POST['id'],	
            ':domain_id',$auth_session->domain_id,	
            ':amount', $_POST['amount'],
            ':expense_account_id', $_POST['expense_account_id'],
            ':biller_id', $_POST['biller_id'],
            ':invoice_id', $_POST['invoice_id'],
            ':product_id', $_POST['product_id'],
            ':customer_id', $_POST['customer_id'],
            ':date', $_POST['date'],
            ':status', $_POST['status'],
            ':note', $_POST['note']
            );

        expense::expense_item_tax($_POST['id'],$_POST['tax_id'][0],$_POST['amount'],"1","update");

        return true;

    }