コード例 #1
0
ファイル: User.php プロジェクト: hukumonline/quart80
 /**
  * _writeInvoice : Individual & Korporasi
  * @return 
  */
 function _writeInvoice($memberId, $totalPromo, $discPromo, $payment, $access = '')
 {
     $aclMan = Pandamp_Acl::manager();
     $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice();
     $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $memberId);
     $rowInvoice = $tblInvoice->fetchAll($where);
     if (count($rowInvoice) <= 0) {
         $rowInvoice = $tblInvoice->fetchNew();
         $rowInvoice->uid = $memberId;
         $rowInvoice->price = $totalPromo;
         $rowInvoice->discount = $discPromo;
         $rowInvoice->invoiceOutDate = date("Y-m-d");
         $rowInvoice->invoiceConfirmDate = "0000-00-00";
         $temptime = time();
         $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime);
         $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUser = $tblUser->fetchRow("kopel=" . $memberId);
         // add user to gacl
         //			$aclMan->addUser($rowUser->username,'member_gratis');
         if (empty($access)) {
             $rowInvoice->save();
         } else {
             $result = $rowInvoice->save();
             if ($result) {
                 $response['success'] = true;
                 $response['message'] = "set invoice:{$memberId} successfully";
             } else {
                 $response['failure'] = true;
             }
             echo Zend_Json::encode($response);
         }
     } else {
         if (!empty($access)) {
             $response['success'] = true;
             $response['message'] = "invoice:{$memberId} sudah dibuat!";
             echo Zend_Json::encode($response);
         }
     }
 }
コード例 #2
0
 function invoiceAction()
 {
     $uid = $this->_getParam('uid') ? $this->_getParam('uid') : '';
     $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice();
     $rowset = $tblInvoice->fetchAll("uid='" . $uid . "'", 'invoiceId DESC');
     $a = array();
     $a['totalCount'] = count($rowset);
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['invoice'][$i]['invoiceId'] = $row->invoiceId;
             $a['invoice'][$i]['uid'] = $row->uid;
             $a['invoice'][$i]['price'] = $row->price;
             $a['invoice'][$i]['discount'] = $row->discount;
             $a['invoice'][$i]['invoiceOutDate'] = $row->invoiceOutDate;
             $a['invoice'][$i]['invoiceConfirmDate'] = $row->invoiceConfirmDate;
             $a['invoice'][$i]['clientBankAccount'] = $row->clientBankAccount;
             $a['invoice'][$i]['isPaid'] = $row->isPaid;
             $a['invoice'][$i]['expirationDate'] = $row->expirationDate;
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['invoice'][0]['invoiceId'] = '';
         $a['invoice'][0]['uid'] = "";
         $a['invoice'][0]['price'] = '';
         $a['invoice'][0]['discount'] = '';
         $a['invoice'][0]['invoiceOutDate'] = '';
         $a['invoice'][0]['invoiceConfirmDate'] = '';
         $a['invoice'][0]['clientBankAccount'] = '';
         $a['invoice'][0]['isPaid'] = "";
         $a['invoice'][0]['expirationDate'] = '';
     }
     echo Zend_Json::encode($a);
 }