57 lines
1.2 KiB
PHP
Executable file
57 lines
1.2 KiB
PHP
Executable file
<?php
|
|
class LineItemsController extends AppController {
|
|
|
|
var $name = 'LineItems';
|
|
var $helpers = array('Html', 'Form', 'Javascript');
|
|
|
|
var $components = array('RequestHandler');
|
|
|
|
|
|
|
|
function ajax_add() {
|
|
$this->layout = 'ajax';
|
|
if(!empty($this->data)) {
|
|
$this->LineItem->create($this->data);
|
|
|
|
if ($this->LineItem->saveAll($this->data)) {
|
|
echo "SUCCESS";
|
|
}
|
|
else {
|
|
echo "FAILURE";
|
|
}
|
|
}
|
|
else {
|
|
echo "NO-DATA";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function getTable($documentID = null) {
|
|
$this->layout = 'ajax';
|
|
if($documentID == null) {
|
|
echo "INVALID DOCUMENT ID";
|
|
}
|
|
else {
|
|
$document = $this->LineItem->Document->find('first',array('conditions'=>array('Document.id'=>$documentID)));
|
|
$this->set('document',$document);
|
|
|
|
$currencies = $this->LineItem->Document->Quote->Currency->find('list', array('fields'=>array('Currency.id','Currency.iso4217')));
|
|
$this->set('currencies',$currencies);
|
|
}
|
|
}
|
|
|
|
|
|
function edit($id = null) {
|
|
|
|
}
|
|
|
|
function add($documentID = null) {
|
|
$document = $this->LineItem->Document->read(null, $documentID);
|
|
$this->set('document', $document);
|
|
$this->set('principles', $this->LineItem->Product->Principle->find('list'));
|
|
}
|
|
|
|
}
|
|
?>
|