public function executeSave() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); $params = array(); foreach (explode('&', $this->getRequestParameter('month_list_ser')) as $p) { $p = explode('=', $p); $params[rawurldecode($p[0])][] = rawurldecode($p[1]); } if (array_key_exists('months', $params)) { foreach ($params['months'] as $month_id) { $payment_student = new PaymentJournal(); $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id')); $c = new Criteria(); $c->add(StudentTypePeer::STUDENT_ID, $student->getId()); $stu_type = StudentTypePeer::doSelectOne($c); $cr = new Criteria(); $cton1 = $cr->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, $stu_type->getPayerTypeId(), Criteria::IN); $cton2 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2, Criteria::IN); $cton3 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendarId(), Criteria::IN); $cton4 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendar()->getParent(), Criteria::IN); $cton3->addOr($cton4); $cton2->addAnd($cton3); $cton1->addAnd($cton2); $cr->add($cton1); $ac_cost = AcademicCostPeer::doSelectOne($cr); $payment_student->setPayer($this->getRequestParameter('student_id')); $payment_student->setAcademicCostId($ac_cost->getId()); $payment_student->setAcademicProcessId($ac_cost->getAcademicProcessId()); $payment_student->setAmount($ac_cost->getAmount()); $payment_student->setPaid($ac_cost->getAmount()); $payment_student->setReceivable($ac_cost->getAmount() - $ac_cost->getAmount()); $payment_student->setPaidAt($this->getRequestParameter('paid_at')); $payment_student->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT); $payment_student->setPaymentModelId($this->getRequestParameter('payment_model_id')); $payment_student->setYear($this->getRequestParameter('year')); $payment_student->setMonth($month_id); $payment_student->setStatus('S'); $payment_student->save(); $amount_changed = $ac_cost->getAmount(); if ($amount_changed != 0) { $ph = new PaymentHistory(); $ph->setPaymentJournal($payment_student); $ph->setAmount($amount_changed); $ph->save(); } } } return $this->redirect('payment_student/list'); #return $this->forward('payment_student', 'preview?student_id='.$this->getRequestParameter('student_id').'&paid_at='.$this->getRequestParameter('paid_at').'&payment_model_id='.$this->getRequestParameter('payment_model_id').'&year='.$this->getRequestParameter('year')); #return $this->redirect('payment_student/preview?student_id='.$this->getRequestParameter('student_id').'&paid_at='.$this->getRequestParameter('paid_at').'&payment_model_id='.$this->getRequestParameter('payment_model_id').'&year='.$this->getRequestParameter('year')); #return $this->redirect('payment_student/list', # 'before'=>"window.open('".$this->getController()->genUrl('/payment_student/printForm'). # "?student_id='+$('student_id').value+'&paid_at='+$('paid_at').value+'&payment_model_id='+$('payment_model_id').value+'&year='+$('year').value, # 'link', # 'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no' # )") }
public function executeGraduateReceipt() { $ta_id = $this->getRequestParameter('id'); $ta = TestApplicantPeer::retrieveByPK($ta_id); $this->forward404Unless($ta); $this->ta = $ta; $ta_detail = $ta->getTestApplicantDetail(); $this->ta_detail = $ta_detail; $cw = new Criteria(); $cw->add(DepartmentDetailPeer::DEPARTMENT_ID, $ta->getDepartment1()); $this->department_detail = DepartmentDetailPeer::doSelectOne($cw); #Uang Osis Untuk SMP if ($ta->getDepartment1() == 2) { $cm = new Criteria(); $cm->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cm->add(AcademicCostPeer::ACADEMIC_COST_COMPONENT_ID, 30); #$cm->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $this->osis = AcademicCostPeer::doSelectOne($cm); } #Calon Siswa dari Al-Azhar if ($ta->getIsAlazhar() == TestApplicant::IS_ALAZHAR) { #Ayah atau Ibu Guru if ($ta_detail->getFatherJob() == TestApplicant::IS_TEACHER || $ta_detail->getMotherJob() == TestApplicant::IS_TEACHER) { #Guru Pengajar Al-Azhar (Siswa Dalam - Guru Dalam) if ($ta_detail->getDetailFatherJob() == 1 || $ta_detail->getDetailMotherJob() == 1) { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 10); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Dalam $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 19); $this->spp = AcademicCostPeer::doSelectOne($cr); #Guru Pengajar (Siswa Dalam - Guru Luar) } else { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 9); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Luar $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 18); $this->spp = AcademicCostPeer::doSelectOne($cr); } #Ayah dan Ibu Guru } elseif ($ta_detail->getFatherJob() == TestApplicant::IS_TEACHER && $ta_detail->getMotherJob() == TestApplicant::IS_TEACHER) { #Guru Pengajar Al-Azhar (Siswa Dalam - Guru Dalam) if ($ta_detail->getDetailFatherJob() == 1 || $ta_detail->getDetailMotherJob() == 1) { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 10); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Dalam $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 19); $this->spp = AcademicCostPeer::doSelectOne($cr); #Guru Pengajar (Siswa Dalam - Guru Luar) } else { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 9); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Luar $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 18); $this->spp = AcademicCostPeer::doSelectOne($cr); } #Siswa Dalam - non Guru } else { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 11); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Non Guru $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 20); $this->spp = AcademicCostPeer::doSelectOne($cr); } #Iuran Jamiyah Siswa Dalam $ce = new Criteria(); $ce->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $ce->add(AcademicCostPeer::ACADEMIC_COST_COMPONENT_ID, 17); $ce->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $ce->add(AcademicCostPeer::PAYER_TYPE_ID, 7); $this->jamiyah = AcademicCostPeer::doSelectOne($ce); #Calon Siswa dari Luar Al-Azhar } else { #Ayah atau Ibu Guru if ($ta_detail->getFatherJob() == TestApplicant::IS_TEACHER || $ta_detail->getMotherJob() == TestApplicant::IS_TEACHER) { #Guru Pengajar Al-Azhar (Siswa Luar - Guru Dalam) if ($ta_detail->getDetailFatherJob() == 1 || $ta_detail->getDetailMotherJob() == 1) { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 13); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Dalam $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 19); $this->spp = AcademicCostPeer::doSelectOne($cr); #Guru Pengajar (Siswa Luar - Guru Luar) } else { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 12); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Luar $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 18); $this->spp = AcademicCostPeer::doSelectOne($cr); } #Ayah dan Ibu Guru } elseif ($ta_detail->getFatherJob() == TestApplicant::IS_TEACHER && $ta_detail->getMotherJob() == TestApplicant::IS_TEACHER) { #Guru Pengajar Al-Azhar (Siswa Luar - Guru Dalam) if ($ta_detail->getDetailFatherJob() == 1 || $ta_detail->getDetailMotherJob() == 1) { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 13); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Dalam $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 19); $this->spp = AcademicCostPeer::doSelectOne($cr); #Guru Pengajar (Siswa Luar - Guru Luar) } else { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 12); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Guru Luar $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 18); $this->spp = AcademicCostPeer::doSelectOne($cr); } #Siswa Luar - non Guru } else { $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 1); $c->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $cton1 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 7); $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, 14); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCostPeer::AMOUNT); $academic_costs = AcademicCostPeer::doSelect($c); $this->academic_costs = $academic_costs; #SPP Bulanan Non Guru $cr = new Criteria(); $cr->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $cr->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2); $cr->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getId()); $cr->add(AcademicCostPeer::PAYER_TYPE_ID, 20); $this->spp = AcademicCostPeer::doSelectOne($cr); } #Iuran Jamiyah Siswa Luar $ce = new Criteria(); $ce->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, RegTestPeriodPeer::retrieveByPK($ta->getRegTestPeriod1())->getRegPeriod()->getAcademicCalendarId()); $ce->add(AcademicCostPeer::ACADEMIC_COST_COMPONENT_ID, 17); $ce->add(AcademicCostPeer::CLASS_GROUP_ID, ClassGroupPeer::retrieveByPk($ta->getClassGroup1())->getParent()); $ce->add(AcademicCostPeer::PAYER_TYPE_ID, 8); $this->jamiyah = AcademicCostPeer::doSelectOne($ce); } $this->papersize = 'a4'; $this->orientation = 'portrait'; $this->setViewClass('sfDomPDF'); }