示例#1
0
                // if present, add fee detail to it
                if (!($feeVoucher = Fee_voucher::findOneByCondition("student_id={$stId} and month={$m}"))) {
                    $feeVoucher = new Fee_voucher();
                    $feeVoucher->student_id->val = $student->id->val;
                    $y = $m >= $class->starting_month->val ? $class->session->val : $class->session->val + 1;
                    $d = $student->last_date_for_fee_submission->val;
                    $feeVoucher->month->val = $m;
                    $feeVoucher->year->val = $y;
                    $feeVoucher->last_date->val = "{$y}-{$m}-{$d}";
                    $feeVoucher->issue_date->val = "{$y}-{$m}-01";
                    if (!$feeVoucher->dbSave()) {
                        $html->echoError("Fee Voucher not already saved. Failed to create a new one.");
                    }
                }
                // create fee voucher detail
                $feeDetail = new Fee_voucher_datail();
                $feeDetail->fee_voucher_id->val = $feeVoucher->id->val;
                $feeDetail->fee_category_id->val = $_POST['category'];
                $feeDetail->amount->val = $_POST['amount'];
                if (!$feeDetail->dbSave()) {
                    $html->echoError("Failed to add fee detail. Please try later.");
                }
            }
        }
        $session->setMessage("Fee Detail added successfully.");
        reloadCurrentPage();
    }
}
if ($students) {
    echo "<form method='post' class='form-horizontal'>";
    echo "<div class='form-group'>";
示例#2
0
    echo $tableEnd;
}
// we have a different display for vouchers
if ($classname == "Fee_voucher") {
    ?>
    <div class="modal fade" id="newFeeRecModel">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Add a New Fee Detail</h4>
                </div>
                <div class="modal-body">

                    <?php 
    $feeDetailObj = new Fee_voucher_datail();
    echo $feeDetailObj->getFormMarkup();
    ?>

                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <script>
        $(function () {
//        var newRecModal = $("#newFeeRecModel");
//        var voucherId = 21456;
//        console.log(newRecModal.find("#amonut"));
示例#3
0
 /**
  * @return bool
  */
 public function autoInsertFee_voucher_datail()
 {
     if ($this->getChildRecs('Fee_voucher_datail')) {
         return true;
     }
     // get default installments
     $student = new Student($this->student_id->val);
     $class = new Clas($student->class_id->val);
     $defInstallments = Default_installment::findByCondition("config_class_id = " . $class->config()->id->val . " AND month = '" . $this->month->val . "'");
     if (!$defInstallments) {
         return true;
     }
     foreach ($defInstallments as $dInsId => $defIns) {
         if ($defIns instanceof Default_installment) {
         }
         $feeVoucherDetail = new Fee_voucher_datail();
         $feeVoucherDetail->fee_voucher_id->val = $this->id->val;
         // if the student has a special discount, default installments will not apply to them:
         if ($student->annual_dues->val < $class->config()->annual_dues->val) {
             global $db;
             $feeVoucherDetail->fee_category_id->val = $db->gfv("id", "config_fee_categories", "category = 'Tuition Fee'");
             $feeVoucherDetail->amount->val = $student->annual_dues->val / count($class->config()->defInstallments());
             //$feeVoucherDetail->pr("this is being inserted");
         } else {
             $feeVoucherDetail->fee_category_id->val = $defIns->fee_category_id->val;
             $feeVoucherDetail->amount->val = $defIns->amount->val;
             //$feeVoucherDetail->pr("default being inserted");
         }
         if (!$feeVoucherDetail->dbSave()) {
             //$feeVoucherDetail->pr();
         }
     }
     return true;
 }
示例#4
0
<?php

/**
 * Created by Naveed-ul-Hassan Malik
 * Auto-Generated Using Script On:
 * Date: Sun 18-Jan-2015
 * Time: 08:18 PM PST
 */
class Fee_voucher_datail extends Fee_voucher_datailAuto
{
    static $joinedTables = array();
    static $childRefField = '';
    static $displayFields = array('fee_voucher_id', 'fee_category_id');
    function __construct($id = null)
    {
        parent::__construct($id);
        $this->fee_voucher_id->fkeyInfo = new FKeyInfo('Fee_voucher', 'id', 'hint');
        $this->fee_category_id->fkeyInfo = new FKeyInfo('Config_fee_category', 'id', 'select');
    }
}
Fee_voucher_datail::$childClasses = array();