/**
  * Tests the update function in the ReceiptController
  * @depends testStore
  * @param void
  * @return void
  */
 public function testUpdate()
 {
     $this->be(User::first());
     $this->runStore($this->input);
     $receiptSaved = receipt::orderBy('id', 'desc')->take(1)->get()->toArray();
     // Update the receipt
     $this->runUpdate($this->inputUpdate, $receiptSaved[0]['id']);
     $receiptUpdated = receipt::orderBy('id', 'desc')->take(1)->get()->toArray();
     $this->assertEquals($receiptUpdated[0]['commodity_id'], $this->inputUpdate['commodity']);
     $this->assertEquals($receiptUpdated[0]['supplier_id'], $this->inputUpdate['supplier']);
     $this->assertEquals($receiptUpdated[0]['quantity'], $this->inputUpdate['quantity']);
     $this->assertEquals($receiptUpdated[0]['batch_no'], $this->inputUpdate['batch_no']);
     $this->assertEquals($receiptUpdated[0]['expiry_date'], $this->inputUpdate['expiry_date']);
 }
示例#2
0
**/
include './lib/customer.defines.php';
include './lib/customer.module.access.php';
include './lib/customer.smarty.php';
include './lib/support/classes/receipt.php';
include './lib/support/classes/receiptItem.php';
if (!has_rights(ACX_INVOICES)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
getpost_ifset(array('id'));
if (empty($id)) {
    Header("Location: A2B_entity_receipt.php?atmenu=payment&section=13");
}
$receipt = new receipt($id);
if ($receipt->getCard() != $_SESSION["card_id"]) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
$items = $receipt->loadItems();
//load customer
$DBHandle = DbConnect();
$card_table = new Table('cc_card', '*');
$card_clause = "id = " . $_SESSION["card_id"];
$card_result = $card_table->Get_list($DBHandle, $card_clause, 0);
$card = $card_result[0];
if (empty($card)) {
    echo "Customer doesn't exist or is not correctly defined for this receipt !";
    die;
示例#3
0
if (! has_rights (ACX_INVOICES)){
	Header ("HTTP/1.0 401 Unauthorized");
	Header ("Location: PP_error.php?c=accessdenied");
	die();
}


getpost_ifset(array('id','page'));

if (empty($id))
{
Header ("Location: A2B_entity_receipt.php?atmenu=payment&section=13");
}

if(empty($page))$page=1;
$receipt = new receipt($id);
if($receipt->getCard() != $_SESSION["card_id"]){
	Header ("HTTP/1.0 401 Unauthorized");
	Header ("Location: PP_error.php?c=accessdenied");
	die();
}
$nbitems = $receipt->nbDetailledItems();
$nb_by_page =100;
$nb_page = ceil($nbitems/$nb_by_page);
$items = $receipt->loadDetailledItems((($page-1)*$nb_by_page),$nb_by_page);
if($nb_page>1)$totalprice = $receipt->SumItemsPrice();
//load customer
$DBHandle  = DbConnect();

$smarty->display('main.tpl');
示例#4
0
include './lib/customer.smarty.php';
include './lib/support/classes/receipt.php';
include './lib/support/classes/receiptItem.php';
if (!has_rights(ACX_INVOICES)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
getpost_ifset(array('id', 'page'));
if (empty($id)) {
    Header("Location: A2B_entity_receipt.php?atmenu=payment&section=13");
}
if (empty($page)) {
    $page = 1;
}
$receipt = new receipt($id);
if ($receipt->getCard() != $_SESSION["card_id"]) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
$nbitems = $receipt->nbDetailledItems();
$nb_by_page = 100;
$nb_page = ceil($nbitems / $nb_by_page);
$items = $receipt->loadDetailledItems(($page - 1) * $nb_by_page, $nb_by_page);
if ($nb_page > 1) {
    $totalprice = $receipt->SumItemsPrice();
}
//load customer
$DBHandle = DbConnect();
$smarty->display('main.tpl');