コード例 #1
0
 public static function add_memo($args)
 {
     if (!isset($args->pidm, $args->term_code, $args->date, $args->amount, $args->detail_code)) {
         throw new \Exception('Pidm, term_code, date, amount, and detail_code must be specified');
     }
     //end if
     $detail_code = \PSU\AR::detail_code($args->detail_code);
     $data = array('pidm' => $args->pidm, 'tran_number' => \PSU\AR\Memos::max_tran_number($args->pidm) + 1, 'term_code' => $args->term_code, 'detail_code' => $detail_code->detail_code, 'user' => 'PREBILLING', 'entry_date' => $args->date, 'desc' => $detail_code->desc, 'expiration_date' => strtotime('+5 days', $args->date), 'effective_date' => $args->date, 'activity_date' => $args->date, 'srce_code' => 'M', 'billing_ind' => 'N', 'create_user' => 'PREBILLING', 'amount' => $args->amount);
     $memo = new \PSU\AR\Memo($data);
     return $memo->save();
 }
コード例 #2
0
ファイル: Bill.php プロジェクト: AholibamaSI/plymouth-webapp
 public static function updateMemo($data, $only_insert = true)
 {
     $person = \PSUPerson::get($data['pidm']);
     $person->bill->memos;
     $exists = false;
     // look for memos
     foreach ((array) $person->bill->memos->terms->terms[$data['term_code']] as $memo) {
         if ($memo->user == $data['userfield'] && $memo->detail_code == $data['detail_code'] && $memo->create_user == $data['create_user']) {
             $exists = true;
         }
         //end if
     }
     //end foreach
     // only save the memo if updates are allowed
     // OR if only inserts are allowed and the memo
     // doesn't already exist
     if (!$only_insert || $only_insert && !$exists) {
         $memo = new \PSU\AR\Memo($data);
         if (!$memo->expiration_date) {
             $memo->expiration_date = \PSU::db('banner')->GetOne("SELECT stvterm_end_date + 90 FROM stvterm WHERE stvterm_code = :term_code", array('term_code' => $data['term_code']));
         }
         //end if
         return $memo->save($only_insert ? 'insert' : 'merge');
     }
     //end if
     return true;
 }