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();
 }
Example #2
0
 /**
  * create or update a payment plan memo
  */
 public static function updatePaymentPlan($data)
 {
     $time = time();
     try {
         $pidm = \IDMObject::getIdentifier($data['psu_id'], 'psu_id', 'pidm');
         if (!$pidm) {
             throw new \Exception("Invalid ID: ID does not exist");
         }
         //end if
     } catch (Exception $i) {
         self::markPaymentPlanAsProcessed($data['id']);
         throw new \Exception("Invalid ID: ID does not exist");
     }
     //end catch
     $data['plan_type'] = strtolower($data['plan_type']);
     $record = array('pidm' => $pidm, 'userfield' => 'TMS_PAYMENT_PLAN', 'user' => 'TMS_PAYMENT_PLAN', 'entry_date' => $time, 'effective_date' => $time, 'activity_date' => $time, 'srce_code' => 'Z', 'data_origin' => 'feed_' . $data['file_sub_type'], 'create_user' => 'tms_' . $data['tms_customer_number'], 'detail_code' => $data['plan_type'] == 'annual' ? 'IQPP' : 'IQPQ', 'billing_ind' => 'N');
     $term_code = $record['term_code'] = \PSU\Student::getCurrentTerm('ug');
     $del_data = array('pidm' => $pidm, 'detail_code' => 'IQPP', 'user' => 'TMS_PAYMENT_PLAN', 'data_origin' => 'feed_' . $data['file_sub_type'], 'create_user' => 'tms_' . $data['tms_customer_number']);
     $memo = new \PSU\AR\Memo($del_data);
     $memo->delete();
     $del_data['detail_code'] = 'IQPQ';
     $memo = new \PSU\AR\Memo($del_data);
     $memo->delete();
     $max_tran_number = \PSU\AR\Memos::max_tran_number($pidm);
     $record['tran_number'] = $max_tran_number + 1;
     if ($data['report_group'] == 'UG') {
         self::parsePaymentPlanUG($term_code, $record, $data);
     } else {
         self::parsePaymentPlanGR($record, $data);
     }
     //end else
     // payment plan parsing was successful for this record.  mark it as processed.
     self::markPaymentPlanAsProcessed($data['id']);
     $person = null;
     return true;
 }
Example #3
0
 /**
  * Set memo-specific entry values
  */
 protected function prep_save($entry)
 {
     $max_number = \PSU\AR\Memos::max_tran_number($entry->pidm);
     $entry->tran_number = $max_number + 1;
     return $entry;
 }