Beispiel #1
0
 protected function _postDelete()
 {
     $modelUserFinance = new App_Model_Db_Table_UserFinance();
     $modelUserFinance->delete("userId='" . $this->kopel . "'");
     $modelUserInvoice = new App_Model_Db_Table_Invoice();
     $modelUserInvoice->delete("uid='" . $this->kopel . "'");
     $acl = Pandamp_Acl::manager();
     $acl->deleteUser($this->username);
     $modelOrder = new App_Model_Db_Table_Order();
     $fetchOrder = $modelOrder->fetchAll("userId='" . $this->kopel . "'");
     foreach ($fetchOrder as $rowOrder) {
         $rowOrder->delete();
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $sDir = $cdn['static']['dir']['photo'];
     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'photo';
     try {
         if (file_exists($sDir . "/" . $this->kopel . ".gif")) {
             unlink($sDir . "/" . $this->kopel . ".gif");
         }
         if (file_exists($sDir . "/" . $this->kopel . ".jpg")) {
             unlink($sDir . "/" . $this->kopel . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->kopel . ".jpeg")) {
             unlink($sDir . "/" . $this->kopel . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->kopel . ".png")) {
             unlink($sDir . "/" . $this->kopel . ".png");
         }
     } catch (Exception $e) {
     }
 }
Beispiel #2
0
 public function payconfirmyesAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     //print_r($this->_request->getParams());
     $id = $this->_request->getParam('orderId');
     $tblOrder = new App_Model_Db_Table_Order();
     $tblHistory = new App_Model_Db_Table_OrderHistory();
     $tblConfirm = new App_Model_Db_Table_PaymentConfirmation();
     $rowOrder = $tblOrder->find($id)->current();
     if ($rowOrder->paymentMethodNote == 'membership') {
         $oldUser = App_Model_Show_User::show()->getUserById($rowOrder->userId);
         $oldpackage = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']);
         $newGroup = App_Model_Show_AroGroup::show()->getUserGroup($rowOrder->note);
         $notes = date("Y-m-d h:i:s") . " - Changed package " . $oldpackage['name'] . " TO " . $newGroup['name'];
         $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes;
         $dataUser = array('packageId' => $rowOrder->note, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username);
         $modelUser = new App_Model_Db_Table_User();
         $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']);
         $modelUserDetail = new App_Model_Db_Table_UserDetail();
         $modelUserDetail->insert($dataUserDetail);
         $acl = Pandamp_Acl::manager();
         $acl->deleteUser($oldUser['username']);
         $acl->addUser($oldUser['username'], $newGroup['name']);
         $tblInvoice = new App_Model_Db_Table_Invoice();
         $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $rowOrder->userId);
         $rowInvoice = $tblInvoice->fetchRow($where);
         if ($rowInvoice) {
             $rowInvoice->invoiceConfirmDate = date("Y-m-d");
             $rowInvoice->isPaid = 'Y';
             // get expiration date
             $temptime = time();
             $temptime = Pandamp_Lib_Formater::DateAdd('m', $oldUser['paymentId'], $temptime);
             $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
             $rowInvoice->save();
             $dataUser['periodeId'] = 3;
         }
         $modelUser->update($dataUser, "kopel='" . $rowOrder->userId . "'");
     }
     //select payment date from paymentconfirmation
     $date = $tblConfirm->fetchAll("orderId = " . $id . " AND confirmed = 0");
     $data['paymentDate'] = $date[0]->paymentDate;
     //update order
     $data['orderStatus'] = 3;
     $tblOrder->update($data, "orderId = " . $id);
     //update paymentconfirmation
     $dataConfirm['confirmed'] = 1;
     $tblConfirm->update($dataConfirm, "orderId = " . $id);
     //add history
     $dataHistory = $tblHistory->fetchNew();
     //history data
     $dataHistory['orderId'] = $id;
     $dataHistory['orderStatusId'] = 3;
     $dataHistory['dateCreated'] = date('Y-m-d');
     $dataHistory['userNotified'] = 1;
     $dataHistory['note'] = 'confirmed';
     $dataHistory->save();
     //mailer
     //$this->Mailer($id, 'user-confirm', 'user');
     $mod = new App_Model_Store_Mailer();
     $mod->sendReceiptToUser($id, ucwords($date[0]->paymentMethod));
     //redirect to confirmation page
     $this->_redirect($this->view->serverUrl() . '/' . $this->view->getLanguage() . '/store/confirm');
 }
Beispiel #3
0
 /**
  * _writeInvoice : Individual & Korporasi
  * @modifiedDate : 2012-11-20 12:53N
  * @todo Changed invoiceOutDate with createdDate from User Table
  * @return 
  */
 function _writeInvoice($memberId, $totalPromo, $discPromo, $payment, $access = '')
 {
     //$aclMan	= Pandamp_Acl::manager();
     $tblInvoice = new App_Model_Db_Table_Invoice();
     $where = $tblInvoice->getAdapter()->quoteInto("uid=?", "{$memberId}");
     $rowInvoice = $tblInvoice->fetchAll($where);
     if (count($rowInvoice) <= 0) {
         $tblUser = new App_Model_Db_Table_User();
         $rowUser = $tblUser->fetchRow("kopel='" . $memberId . "'");
         $rowInvoice = $tblInvoice->fetchNew();
         $rowInvoice->uid = $memberId;
         $rowInvoice->price = $totalPromo;
         $rowInvoice->discount = $discPromo;
         //$rowInvoice->invoiceOutDate = date("Y-m-d");
         $rowInvoice->invoiceOutDate = date("Y-m-d", strtotime($rowUser->createdDate));
         $rowInvoice->invoiceConfirmDate = "0000-00-00";
         //$temptime = time();
         $temptime = strtotime($rowUser->createdDate);
         if ($rowUser->trialInDays == 0) {
             $trial = 5;
         } else {
             $trial = $rowUser->trialInDays;
         }
         $temptime = Pandamp_Lib_Formater::DateAdd('d', $trial, $temptime);
         $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
         if (empty($access)) {
             $rowInvoice->save();
         } else {
             $result = $rowInvoice->save();
             if ($result) {
                 $r = $memberId . " OK";
             } else {
                 $r = 'failure';
             }
         }
     } else {
         if (!empty($access)) {
             $r = "invoice:{$memberId} sudah pernah dibuat!";
         }
     }
     return $r;
 }
Beispiel #4
0
 function invoicelistAction()
 {
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) {
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted');
     }
     $this->_helper->layout->setLayout('layout-customer-credential');
     $id = $this->_getParam("id");
     $userInvoiceList = App_Model_Show_Invoice::show()->getInvoiceById($id);
     $this->view->userInvoiceList = $userInvoiceList;
     $user = App_Model_Show_User::show()->getUserById($id);
     if ($user) {
         $this->view->user = $user;
     }
     $this->view->identity = $this->_user;
     /**
      * UPDATED:July 25, 2012
      * @modifiedDate: 2012-11-20 15:10N
      * @todo Invoice can add more than one
      * comment line 897-899
      */
     if ($this->getRequest()->isPost()) {
         if (isset($user['paymentId']) && $user['paymentId'] != 0) {
             $tblInvoice = new App_Model_Db_Table_Invoice();
             //			$where = $tblInvoice->getAdapter()->quoteInto("uid=?",$this->getRequest()->getPost('kopel'));
             //			$rowInvoice = $tblInvoice->fetchAll($where);
             //			if (count($rowInvoice) <= 0)
             //			{
             $rowInvoice = $tblInvoice->fetchNew();
             $rowInvoice->uid = $this->getRequest()->getPost('kopel');
             $rowInvoice->price = $this->getRequest()->getPost('price');
             $rowInvoice->discount = $this->getRequest()->getPost('disc');
             $rowInvoice->invoiceOutDate = $this->getRequest()->getPost('invoiceOutDate');
             $rowInvoice->invoiceConfirmDate = $this->getRequest()->getPost('invoiceConfirmDate');
             $rowInvoice->clientBankAccount = $this->getRequest()->getPost('clientBankAccount');
             $rowInvoice->isPaid = $this->getRequest()->getPost('isPaid');
             $rowInvoice->expirationDate = $this->getRequest()->getPost('expirationDate');
             $rowInvoice->save();
         } else {
             die('Lamanya berlangganan kosong, silahkan edit dulu data pelanggan');
         }
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/customer/user/invoicelist/id/' . $this->getRequest()->getPost('kopel'));
         //			}
     }
 }
 public function editAction()
 {
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) {
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted');
     }
     $this->_helper->layout->setLayout('layout-customer-credential');
     $id = $this->_getParam("id");
     $tblInvoice = new App_Model_Db_Table_Invoice();
     $rowset = $tblInvoice->find($id)->current();
     $this->view->row = $rowset;
     if ($this->getRequest()->isPost()) {
         $rowset->price = $this->getRequest()->getPost('price');
         $rowset->discount = $this->getRequest()->getPost('disc');
         $rowset->invoiceOutDate = $this->getRequest()->getPost('invoiceOutDate');
         $rowset->invoiceConfirmDate = $this->getRequest()->getPost('invoiceConfirmDate');
         $rowset->clientBankAccount = $this->getRequest()->getPost('clientBankAccount');
         $rowset->isPaid = $this->getRequest()->getPost('isPaid');
         $rowset->expirationDate = $this->getRequest()->getPost('expirationDate');
         $rowset->save();
         $notes = date("Y-m-d h:i:s") . ' ' . $this->_user->username . " - Modify invoice:" . $id;
         $data = array('notes' => new Zend_Db_Expr("CONCAT(ifnull(notes,''),' \n{$notes}')"));
         $modelUser = new App_Model_Db_Table_User();
         $modelUser->update($data, "kopel='" . $this->getRequest()->getPost('uid') . "'");
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/customer/user/invoicelist/id/' . $this->getRequest()->getPost('uid'));
     }
 }