Пример #1
0
 protected function processDeferral($row)
 {
     if ($row) {
         $paymentRepo = $this->manager->getRepository('TSK\\PaymentBundle\\Entity\\Payment');
         $payment = $paymentRepo->findOneBy(array('legacyPaymentId' => $row[0]));
         if (!$payment) {
             print "Can't find payment " . $row[0] . "\n";
             return null;
         }
         $chargePaymentRepo = $this->manager->getRepository('TSK\\PaymentBundle\\Entity\\ChargePayment');
         $cps = $chargePaymentRepo->findBy(array('payment' => $payment));
         foreach ($cps as $cp) {
             $journal = new Journal();
             $journal->setSchool($this->school);
             $journal->setCharge($cp->getCharge());
             $journal->setPayment($cp->getPayment());
             $journal->setJournalDate(new \DateTime($row[3]));
             $journal->setDebitAmount($row[2]);
             $journal->setDebitAccount($this->deferralAccount);
             $journal->setCreditAmount($row[2]);
             $journal->setCreditAccount($this->incomeAccount);
             $this->manager->persist($journal);
             $this->manager->flush();
         }
     }
 }
Пример #2
0
 public function generateJournal($arr)
 {
     $cp = $arr['chargePayment'];
     $journal = new Journal();
     $journal->setSchool($cp->getCharge()->getSchool());
     $journal->setDebitAmount($arr['debitAmount']);
     $journal->setDebitAccount($arr['debitAccount']);
     $journal->setCreditAmount($arr['creditAmount']);
     $journal->setCreditAccount($arr['creditAccount']);
     $journal->setDescription($arr['description']);
     $journal->setPostedDate(new \DateTime($arr['date']));
     $journal->setCharge($cp->getCharge());
     $journal->setPayment($cp->getPayment());
     return $journal;
 }