Exemple #1
0
 function init()
 {
     parent::init();
     $this->addCondition('type', 'PurchaseInvoice');
     $this->getElement('document_no')->defaultValue($this->newNumber());
     $this->addHook('beforeDelete', [$this, 'deleteTransactions']);
 }
Exemple #2
0
 function init()
 {
     parent::init();
     $this->addCondition('type', 'SalesOrder');
     $this->getElement('document_no')->defaultValue($this->newNumber());
     $this->addExpression('days_left')->set(function ($m, $q) {
         $date = $m->add('\\xepan\\base\\xDate');
         $diff = $date->diff(date('Y-m-d H:i:s', strtotime($m['created_at'])), date('Y-m-d H:i:s', strtotime($m['due_date'] ? $m['due_date'] : $this->app->today)), 'Days');
         return "'" . $diff . "'";
     });
 }
Exemple #3
0
 function init()
 {
     parent::init();
     $this->addCondition('type', 'SalesInvoice');
     $this->getElement('document_no')->defaultValue($this->newNumber());
     $nominal_field = $this->getField('nominal_id');
     $nominal_field->defaultValue($this->add('xepan\\accounts\\Model_Ledger')->load('Sales Account')->get('id'));
     $sale_group = $this->add('xepan\\accounts\\Model_Group')->load("Sales");
     $sale_group->addCondition($sale_group->dsql()->orExpr()->where('root_group_id', $sale_group->id)->where('parent_group_id', $sale_group->id)->where('id', $sale_group->id));
     $model = $nominal_field->getModel();
     $model->addCondition('group_id', $sale_group->id);
     $this->addHook('beforeDelete', [$this, 'notifyDeletion']);
     $this->addHook('beforeDelete', [$this, 'deleteTransactions']);
     $this->addHook('beforeDelete', [$this, 'removeLodgement']);
 }
Exemple #4
0
 function init()
 {
     parent::init();
     $this->addCondition('type', 'Quotation');
     $this->getElement('document_no')->defaultValue($this->newNumber());
 }