Example #1
0
 public static function create($type, $debitorId, $date, $amount, $paymentMethod = null, $erpContextId = 'ERP')
 {
     if (is_null($paymentMethod)) {
         $paymentMethod = Billing_Controller_PaymentMethod::getInstance()->getDefaultPaymentMethod();
     }
     if ($paymentMethod instanceof Billing_Model_PaymentMethod) {
         $paymentMethod = $paymentMethod->getId();
     }
     $obj = new self();
     $obj->__set('debitor_id', $debitorId);
     $obj->__set('amount', $amount);
     $obj->__set('payment_date', $date);
     $obj->__set('type', $type);
     $obj->__set('payment_method_id', $paymentMethod);
     return $obj;
 }
 public static function createFromBatchJobMonitionItem(Billing_Model_Receipt $monitionReceipt, Billing_Model_BatchJobMonitionItem $batchJobMonitionItem)
 {
     $fromRecord = clone $batchJobMonitionItem;
     $fromRecord->flatten();
     $openItem = $fromRecord->getForeignRecord('open_item_id', Billing_Controller_OpenItem::getInstance());
     $obj = new self();
     $obj->__set('erp_context_id', $fromRecord->__get('erp_context_id'));
     $obj->__set('monition_receipt_id', $monitionReceipt->getId());
     $obj->__set('open_item_id', $openItem->getId());
     $obj->__set('debitor_id', $openItem->getForeignId('debitor_id'));
     $obj->__set('due_date', $openItem->__get('due_date'));
     $obj->__set('monition_date', new Zend_Date());
     $obj->__set('open_sum', $fromRecord->__get('open_sum'));
     $obj->__set('total_sum', $fromRecord->__get('total_sum'));
     $obj->__set('due_days', $fromRecord->__get('due_days'));
     $obj->__set('monition_stage', $fromRecord->__get('monition_stage'));
     return $obj;
 }
Example #3
0
 /**
  * 
  * Enter description here ...
  * @param unknown_type $type
  * @throws Exception
  */
 public static function create($type)
 {
     if (!self::isValidType($type)) {
         throw new Exception('Invalid receipt type given');
     }
     $obj = new self();
     $obj->__set('type', $type);
     return $obj;
 }
Example #4
0
 public static function createSchedulerBatchJob($accountId, $category, $name1 = null, $name2 = null, $data = null)
 {
     $job = new self();
     $job->__set('job_name1', $name1);
     $job->__set('job_name2', $name2);
     $job->__set('job_category', $category);
     $job->__set('account_id', $accountId);
     $job->__set('job_type', self::TYPE_SCHEDULER);
     $job->setData($data);
     $job->setDefaultData();
     return $job;
 }