コード例 #1
0
ファイル: CreateLoad.class.php プロジェクト: pars5555/crm
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $this->addParam('req', isset($_SESSION['action_request']) ? $_SESSION['action_request'] : []);
     unset($_SESSION['action_request']);
     $this->addParam('payment_methods', PaymentMethodManager::getInstance()->selectAdvance('*', ['active', '=', 1], ['name']));
     $this->addParam('partners', PartnerManager::getInstance()->selectAdvance('*', [], ['name']));
     $this->addParam('defaultPaymentMethodId', SettingManager::getInstance()->getSetting('default_payment_method_id'));
 }
コード例 #2
0
ファイル: UpdateLoad.class.php プロジェクト: pars5555/crm
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $id = intval(NGS()->args()->id);
     $purchaseOrder = PurchaseOrderManager::getInstance()->selectByPK($id);
     if ($purchaseOrder) {
         if (!isset($_SESSION['action_request'])) {
             $_SESSION['action_request'] = ['order_date' => $this->cutSecondsFromDateTime($purchaseOrder->getOrderDate()), 'payment_deadline' => $purchaseOrder->getPaymentDeadline(), 'partnerId' => $purchaseOrder->getPartnerId(), 'note' => $purchaseOrder->getNote()];
         }
         $this->addParam("purchaseOrder", $purchaseOrder);
         $this->addParam('req', $_SESSION['action_request']);
         unset($_SESSION['action_request']);
         $this->addParam('payment_methods', PaymentMethodManager::getInstance()->selectAdvance('*', ['active', '=', 1], ['name']));
         $this->addParam('partners', PartnerManager::getInstance()->selectAdvance('*', [], ['name']));
         $this->addParam('defaultPaymentMethodId', SettingManager::getInstance()->getSetting('default_payment_method_id'));
     }
 }
コード例 #3
0
ファイル: UpdateLoad.class.php プロジェクト: pars5555/crm
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $id = intval(NGS()->args()->id);
     $paymentOrder = PaymentTransactionManager::getInstance()->selectByPK($id);
     if ($paymentOrder) {
         if (!isset($_SESSION['action_request'])) {
             $_SESSION['action_request'] = ['date' => $this->cutSecondsFromDateTime($paymentOrder->getDate()), 'partnerId' => $paymentOrder->getPartnerId(), 'billingMethodId' => $paymentOrder->getPaymentMethodId(), 'currencyId' => $paymentOrder->getCurrencyId(), 'note' => $paymentOrder->getNote(), 'signature' => $paymentOrder->getSignature(), 'amount' => $paymentOrder->getAmount(), 'isExpense' => $paymentOrder->getIsExpense(), 'paid' => $paymentOrder->getPaid()];
         }
         $this->addParam("paymentOrder", $paymentOrder);
         $this->addParam('req', $_SESSION['action_request']);
         unset($_SESSION['action_request']);
         $this->addParam('payment_methods', PaymentMethodManager::getInstance()->selectAdvance('*', ['active', '=', 1], ['name']));
         $this->addParam('currencies', CurrencyManager::getInstance()->selectAdvance('*', ['active', '=', 1], ['name']));
         $this->addParam('partners', PartnerManager::getInstance()->selectAdvance('*', [], ['name']));
         $this->addParam('defaultCurrencyId', SettingManager::getInstance()->getSetting('default_currency_id'));
         $this->addParam('defaultPaymentMethodId', SettingManager::getInstance()->getSetting('default_payment_method_id'));
     }
 }
コード例 #4
0
ファイル: ListLoad.class.php プロジェクト: pars5555/crm
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $this->addParam('payment_methods', PaymentMethodManager::getInstance()->selectAdvance('*', ['active', '=', 1], ['name']));
     $this->addParam('partners', PartnerManager::getInstance()->selectAdvance('*', [], ['name']));
     $this->addParam('products', ProductManager::getInstance()->selectAdvance('*', [], ['name']));
     $limit = 100;
     list($where, $offset, $sortByFieldName, $selectedFilterSortByAscDesc) = $this->initFilters($limit);
     $saleOrders = SaleOrderManager::getInstance()->getSaleOrdersFull($where, $sortByFieldName, $selectedFilterSortByAscDesc, $offset, $limit);
     $this->addParam('saleOrders', $saleOrders);
     $count = SaleOrderManager::getInstance()->getLastSelectAdvanceRowsCount();
     if (count($saleOrders) == 0 && $count > 0) {
         $this->redirectIncludedParamsExeptPaging();
     }
     $pagesCount = ceil($count / $limit);
     $this->addParam('pagesCount', $pagesCount);
     $currencyManager = CurrencyManager::getInstance();
     $this->addParam('currencies', $currencyManager->mapDtosById($currencyManager->selectAdvance('*', ['active', '=', 1])));
 }
コード例 #5
0
 public function updatePaymentOrder($id, $partnerId, $paymentMethodId, $currencyId, $amount, $date, $note, $signature = "[]", $paid = true, $isExpense = false)
 {
     $partnerManager = PartnerManager::getInstance();
     $partner = $partnerManager->selectByPK($partnerId);
     if (empty($partner)) {
         throw new NgsErrorException("Partner does not exists with given id: " . $partnerId);
     }
     $paymentMethodManager = PaymentMethodManager::getInstance();
     $paymentMethod = $paymentMethodManager->selectByPK($paymentMethodId);
     if (empty($paymentMethod)) {
         throw new NgsErrorException("PaymentMethod does not exists with given id: " . $paymentMethodId);
     }
     $dto = $this->selectByPK($id);
     if ($dto) {
         $dto->setPartnerId($partnerId);
         $dto->setPaymentMethodId($paymentMethodId);
         $dto->setCurrencyId($currencyId);
         $rate = CurrencyRateManager::getInstance()->getCurrencyRateByDate($date, $currencyId);
         $dto->setCurrencyRate($rate);
         $dto->setAmount($amount);
         $dto->setDate($date);
         $dto->setNote($note);
         $dto->setIsExpense($isExpense);
         $dto->setPaid($paid);
         $dto->setSignature($signature);
         return $this->updateByPk($dto);
     }
     return false;
 }