public function upDateLoanDisburse($data){ $db = $this->getAdapter(); // $db->beginTransaction(); // try{ $datagroup = array( 'group_id'=>$data['group_id'], 'co_id'=>$data['co_id'], 'zone_id'=>$data['zone'], 'level'=>$data['level'], 'date_release'=>$data['release_date'], 'date_line'=>$data['date_line'], 'create_date'=>date("Y-m-d"), 'branch_id'=>$data['branch_id'], 'total_duration'=>$data['period'], 'first_payment'=>$data['first_payment'], 'time_collect'=>$data['time'], 'pay_term'=>$data['pay_every'], 'payment_method'=>$data['repayment_method'], 'holiday'=>$data['every_payamount'], 'is_renew'=>0, 'loan_type'=>2, 'collect_typeterm'=>$data['collect_termtype'] ); $g_id = $data['id'];//add group loan $where = $db->quoteInto('g_id=?', $g_id); $this->update($datagroup, $where); unset($datagroup); $this->_name='ln_loan_member';//update member $arr =array('status'=>0); $where = $db->quoteInto('group_id=?', $g_id); $this->update($arr, $where); $rows= $this->getAllMemberLoanById($g_id); $s_where = array(); $where = ''; foreach ($rows as $id => $row){ $s_where[] = "`member_id` = ".$row['member_id']; } $where .= implode(' OR ',$s_where); $this->_name='ln_loanmember_funddetail';//update schedule detail of member $this->update($arr, $where); $this->_name='ln_loan_member';//update member $next_payment = $data['first_payment']; $start_date = $data['release_date'];//loan release; $curr_type = $data['currency_type']; $tranlist = explode(',',$data['record_row']); $dbtable = new Application_Model_DbTable_DbGlobal(); foreach ($tranlist as $i) { $this->_name='ln_loan_member';//update member $loan_number = $dbtable->getLoanNumber(); $datamember = array( 'group_id'=>$g_id, 'loan_number'=>$loan_number, 'client_id'=>$data['member_id'.$i], 'payment_method'=>$data['repayment_method'], 'currency_type'=>$data['currency_type'], 'admin_fee'=>$data['admin_fee'.$i], 'total_capital'=>$data['debt_amount'.$i],//$data[''], 'interest_rate'=>$data['interest_rate'], 'branch_id'=>$data['branch_id'], 'pay_before'=>$data['pay_before'], 'pay_after'=>$data['pay_late'], 'graice_period'=>$data['graice_pariod'], 'amount_collect_principal'=>$data['amount_collect'], 'collect_typeterm'=>$data['collect_termtype'], 'loan_purpose'=>$data['note'.$i], 'semi'=>$data['amount_collect_pricipal'] ); $member_id = $this->insert($datamember);//add member loan unset($datamember); $old_remain_principal = 0; $old_pri_permonth = 0; $old_interest_paymonth = 0; $old_amount_day = 0; $amount_collect = 1; $ispay_principal=2;//for payment type = 5; $is_subremain = 2; $remain_principal = $data['debt_amount'.$i]; $this->_name='ln_loanmember_funddetail'; $borrow_term = $dbtable->getSubDaysByPaymentTerm($data['pay_every'],null);//return amount day for payterm $amount_borrow_term = $borrow_term*$data['period'];//amount of borrow $fund_term = $dbtable->getSubDaysByPaymentTerm($data['collect_termtype'],null);//return amount day for payterm $amount_fund_term = $fund_term*$data['amount_collect']; $loop_payment = ($amount_borrow_term)/($amount_fund_term); $payment_method = $data['repayment_method']; $this->_name='ln_loanmember_funddetail'; for($j=1;$j<=$loop_payment;$j++){ //return amount next day collection $amount_collect = $data['amount_collect']; $day_perterm = $dbtable->getSubDaysByPaymentTerm($data['collect_termtype'],$amount_collect);//return amount day for payterm //$day_perterm = $dbtable->getSubDaysByPaymentTerm($data['pay_every'],$amount_collect);//return amount day for payterm $str_next = $dbtable->getNextDateById($data['collect_termtype'],$data['amount_collect']);//for next,day,week,month; if($payment_method==1){//decline//completed // $pri_permonth = ($data['debt_amount'.$j]/($data['period']-$data['graice_pariod'])*$amount_collect); $pri_permonth = $data['debt_amount'.$i]/(($amount_borrow_term-($data['graice_pariod']*$borrow_term))/$amount_fund_term); $pri_permonth = $this->round_up_currency($curr_type, $pri_permonth); if($j*$amount_collect<=$data['graice_pariod']){//check here//for graice period $pri_permonth = 0; } if($j!=1){ if($data['graice_pariod']!=0){//if collect =1 not other check if($j*$amount_collect>$data['graice_pariod']+$amount_collect){//not wright $remain_principal = $remain_principal-$pri_permonth; }else{ } }else{ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា} } if($j==$loop_payment){//check condition here//for end of record only $pri_permonth = $data['debt_amount'.$i]-$pri_permonth*($j-(($data['graice_pariod']/$amount_collect)+1));//code error here } $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); $interest_paymonth = $remain_principal*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm); }else{ $next_payment = $data['first_payment']; $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); $interest_paymonth = ($data['debt_amount'.$i])*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm); } }elseif($payment_method==2){//baloon $pri_permonth=0; if(($j*$amount_fund_term)==$amount_borrow_term){//end record//if j == loop $pri_permonth = $data['debt_amount'.$i]; $remain_principal = $pri_permonth;//$remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា } if($j!=1){ $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); // $interest_paymonth = $data['debt_amount'.$i]*($data['interest_rate']/100)*($amount_day/$day_perterm); }else{ $next_payment = $data['first_payment'];//$dbtable->getNextPayment($str_next, $start_date, $data['amount_collect'],$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); } $interest_paymonth = $data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm); }elseif($payment_method==3){//fixed rate $pri_permonth = ($data['debt_amount'.$i]/($amount_borrow_term/$amount_fund_term)); $pri_permonth =$this->round_up_currency($curr_type,$pri_permonth); if($j!=1){ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា if($i==$loop_payment){//for end of record only $pri_permonth = $remain_principal; } $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); }else{ $next_payment = $data['first_payment']; $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); } $interest_paymonth = $data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($day_perterm/$day_perterm); }elseif($payment_method==4){//fixed payment full last period yes if($j!=1){ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $interest_paymonth = $data['debt_amount'.$i]*($data['interest_rate']/100)*($amount_day/$day_perterm); }else{ $next_payment = $data['first_payment']; } $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); $interest_paymonth = $remain_principal*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm); $interest_paymonth = $this->round_up_currency($curr_type, $interest_paymonth); $pri_permonth = $data['amount_collect_pricipal']-$interest_paymonth;//don't understand if($j==$loop_payment){//for end of record only $pri_permonth = $remain_principal; } }elseif($payment_method==5){//semi baloon//ok if($j!=1){ $ispay_principal++; $is_subremain++; $pri_permonth = ($data['debt_amount'.$i]/$data['period'])*$data['amount_collect_pricipal']; $pri_permonth = ($curr_type==1)?round($pri_permonth,-2):$pri_permonth; $pri_permonth=0; if(($is_subremain-1)==$data['amount_collect_pricipal']){ $pri_permonth = ($data['debt_amount'.$i]/$data['period'])*$data['amount_collect_pricipal']; $is_subremain=1; } if(($ispay_principal-1)==$data['amount_collect_pricipal']+1){ $remain_principal = $remain_principal-($data['debt_amount'.$i]/$data['period'])*$data['amount_collect_pricipal']; $ispay_principal=2; } if($j==($data['period']/$data['amount_collect'])){//check condition here//for end of record only $pri_permonth = ($data['debt_amount'.$i]/$data['period'])*$data['amount_collect_pricipal']; $pri_permonth = $data['debt_amount'.$i]-$pri_permonth*($j-(($data['graice_pariod']/$amount_collect)+1));//code error here } $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); $interest_paymonth = $remain_principal*($data['interest_rate']/100)*($amount_day/$day_perterm); }else{ $pri_permonth = 0;//check if get pri first too much change; $next_payment = $data['first_payment']; $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); $interest_paymonth = $data['debt_amount'.$i]*($data['interest_rate']/100)*($amount_day/$day_perterm); } }else{// fixed payment with fixed rate $pri_permonth = $data['debt_amount'.$i]/$data['period']*$amount_collect; $pri_permonth =$this->round_up_currency($curr_type, $pri_permonth); if($j!=1){ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា $start_date = $next_payment; if($j==$loop_payment){//check condition here//for end of record only $pri_permonth = $remain_principal; } $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); }else{ $next_payment = $data['first_payment']; $amount_day = $dbtable->CountDayByDate($start_date,$next_payment); } $interest_paymonth = ($data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)/$data['period']*($day_perterm/$day_perterm)); } $old_remain_principal =$old_remain_principal+$remain_principal; $old_pri_permonth = $old_pri_permonth+$pri_permonth; $old_interest_paymonth = $old_interest_paymonth+$interest_paymonth; $old_amount_day =$old_amount_day+ $amount_day; if($data['amount_collect']==$amount_collect){ $datapayment = array( 'member_id'=>$member_id, 'total_principal'=>$remain_principal,//good 'principal_permonth'=> $old_pri_permonth,//good 'total_interest'=>$old_interest_paymonth,//good 'total_payment'=>$old_pri_permonth+$old_interest_paymonth,//good 'date_payment'=>$next_payment,//good 'is_completed'=>0, 'branch_id'=>1, 'status'=>1, 'amount_day'=>$old_amount_day, ); $this->insert($datapayment); $amount_collect=0; $old_remain_principal = 0; $old_pri_permonth = 0; $old_interest_paymonth = 0; $old_amount_day = 0; }else{ } $amount_collect++; } if(($amount_borrow_term)%($amount_fund_term)!=0){///end for record odd number only $start_date = $next_payment;//$dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $amount_day = $amount_day = $dbtable->CountDayByDate($start_date,$data['date_line']); if($payment_method==1){ $pri_permonth =$remain_principal-$pri_permonth; // $pri_permonth*($amount_day/$amount_fund_term);//check it if khmer currency $pri_permonth = ($curr_type==1)?round($pri_permonth,-2):$pri_permonth; $interest_paymonth = ($pri_permonth*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm)); }elseif($payment_method==2){ $pri_permonth = ($curr_type==1)?round($data['total_amount'],-2):$data['debt_amount'.$i]; $pri_permonth = ($curr_type==1)? round($pri_permonth,-2): round($pri_permonth); $remain_principal = $pri_permonth;//$remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា $interest_paymonth = ($data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm)); }elseif($payment_method==3){ $pri_permonth = $remain_principal-$pri_permonth; $interest_paymonth = ($data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($day_perterm/$day_perterm)); $pri_permonth = ($curr_type==1)? round($pri_permonth,-2): round($pri_permonth); }elseif($payment_method==4){ $interest_paymonth = ($data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm)); $pri_permonth = $remain_principal-$pri_permonth; }elseif($payment_method==5){ $pri_permonth = $remain_principal; $interest_paymonth = ($remain_principal*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm)); }elseif($payment_method==6){ $pri_permonth = $pri_permonth*($amount_day/$amount_fund_term); $interest_paymonth = ($data['debt_amount'.$i]*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm)); } $datapayment = array( 'member_id'=>$member_id, 'total_principal'=>$pri_permonth,//good 'principal_permonth'=> $pri_permonth,//good 'total_interest'=>$interest_paymonth,//good 'total_payment'=>$interest_paymonth+$pri_permonth,//good 'date_payment'=>$data['date_line'],//good 'is_completed'=>0, 'branch_id'=>1, 'status'=>1, 'amount_day'=>$amount_day, ); $this->insert($datapayment); } } // exit(); // $db->commit(); // return 1; // }catch (Exception $e){ // $db->rollBack(); // echo $e->getMessage();exit(); // return $e->getMessage(); // } }
public function addNewLoanIL($data){ $db = $this->getAdapter(); $db->beginTransaction(); try{ $datagroup = array( 'group_id'=>$data['member'], 'co_id'=>$data['co_id'], 'zone_id'=>$data['zone'], 'level'=>$data['level'], 'date_release'=>$data['release_date'], 'date_line'=>$data['date_line'], 'create_date'=>date("Y-m-d"), 'branch_id'=>$data['branch_id'], 'total_duration'=>$data['period'], 'first_payment'=>$data['first_payment'], 'time_collect'=>$data['time'], 'pay_term'=>$data['pay_every'], 'payment_method'=>$data['repayment_method'], 'holiday'=>$data['every_payamount'], 'is_renew'=>0, 'loan_type'=>1, 'collect_typeterm'=>$data['collect_termtype'], 'for_loantype'=>$data['loan_type'], 'user_id'=>$this->getUserId() ); $g_id = $this->insert($datagroup);//add group loan unset($datagroup); $dbtable = new Application_Model_DbTable_DbGlobal(); $loan_number = $dbtable->getLoanNumber($data); $datamember = array( 'group_id'=>$g_id, 'loan_number'=>$loan_number,//$data['loan_code'], 'client_id'=>$data['member'], 'payment_method'=>$data['repayment_method'], 'currency_type'=>$data['currency_type'], 'total_capital'=>$data['total_amount'],//$data[''], 'admin_fee'=>$data['loan_fee'], 'other_fee'=>$data['other_fee'], 'interest_rate'=>$data['interest_rate'], 'status'=>1, 'is_completed'=>0, 'branch_id'=>$data['branch_id'], //'pay_before'=>$data['pay_before'], 'pay_after'=>$data['pay_late'], 'graice_period'=>$data['graice_pariod'], 'amount_collect_principal'=>$data['amount_collect'], 'collect_typeterm'=>$data['collect_termtype'], 'semi'=>$data['amount_collect_pricipal'] ); $this->_name='ln_loan_member'; $member_id = $this->insert($datamember);//add member loan unset($datamember); // $arr =array( // 'branch_id'=>$data['branch_id'], // 'receipt_number'=>$data['loan_code'], // 'date'=>$data['release_date'], // 'create_date'=>date('Y-m-d'), // 'note'=>'from loan disburse', // 'from_location'=>1, // 'user_id'=>$this->getUserId(), // 'balance'=>$data['total_amount'], // 'loan_fee'=>$data['loan_fee'], // 'client_id'=>$data['member'], // 'currency_type'=>$data['currency_type'] // ); // $db_j = new Accounting_Model_DbTable_DbJournal(); // $jur_id = $db_j->addTransactionJournal($arr); $remain_principal = $data['total_amount']; $next_payment = $data['first_payment']; $start_date = $data['release_date'];//loan release; $from_date = $data['release_date']; $old_remain_principal = 0; $old_pri_permonth = 0; $old_interest_paymonth = 0; $old_amount_day = 0; $amount_collect = 1; $ispay_principal=2;//for payment type = 5; $is_subremain = 2; $curr_type = $data['currency_type']; //for IRR method if($data['repayment_method']==6){ $term_install = $data['period']; $loan_amount = $data['total_amount']; $total_loan_amount = $loan_amount+($loan_amount*$data['interest_rate']/100*$term_install); $irr_interest = $this->calCulateIRR($total_loan_amount,$loan_amount,$term_install,$curr_type); } //end IRR method $this->_name='ln_loanmember_funddetail'; $borrow_term = $dbtable->getSubDaysByPaymentTerm($data['pay_every'],null);//return amount day for payterm $amount_borrow_term = $borrow_term*$data['period'];//amount of borrow $fund_term = $dbtable->getSubDaysByPaymentTerm($data['collect_termtype'],null);//return amount day for payterm $amount_fund_term = $fund_term*$data['amount_collect']; $loop_payment = ($amount_borrow_term)/($amount_fund_term); $payment_method = $data['repayment_method']; $str_next = $dbtable->getNextDateById($data['collect_termtype'],$data['amount_collect']);//for next,day,week,month; for($i=1;$i<=$loop_payment;$i++){ $amount_collect = $data['amount_collect']; // $day_perterm = $dbtable->getSubDaysByPaymentTerm($data['collect_termtype'],$amount_collect);//return amount day for payterm // $str_next = $dbtable->getNextDateById($data['collect_termtype'],$data['amount_collect']);//for next,day,week,month; if($payment_method==1){//decline//completed // $pri_permonth = ($data['total_amount']/($data['period']-$data['graice_pariod'])*$amount_collect); $pri_permonth = $data['total_amount']/(($amount_borrow_term-($data['graice_pariod']*$borrow_term))/$amount_fund_term); $pri_permonth = $this->round_up_currency($curr_type, $pri_permonth); if($i*$amount_collect<=$data['graice_pariod']){//check here//for graice period $pri_permonth = 0; } if($i!=1){ if($data['graice_pariod']!=0){//if collect =1 not other check if($i*$amount_collect>$data['graice_pariod']+$amount_collect){//not wright $remain_principal = $remain_principal-$pri_permonth; }else{ } }else{ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា} } if($i==$loop_payment){//check condition here//for end of record only // echo $remain_principal; $pri_permonth = $data['total_amount']-$pri_permonth*($i-(($data['graice_pariod']/$amount_collect)+1));//code error here } $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); //$next_payment = $dbtable->checkDefaultDate($str_next, $defaultnext_payment, $data['amount_collect']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $remain_principal*($data['interest_rate']/100/$borrow_term)*$amount_day; }else{ $next_payment = $data['first_payment']; $next_payment = $dbtable->checkFirstHoliday($next_payment,$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $remain_principal*($data['interest_rate']/100/$borrow_term)*$amount_day; } }elseif($payment_method==2){//baloon $pri_permonth=0; if(($i*$amount_fund_term)==$amount_borrow_term){//check here $pri_permonth = ($curr_type==1)?round($data['total_amount'],-2):$data['total_amount']; $pri_permonth =$this->round_up_currency($curr_type, $pri_permonth); $remain_principal = $pri_permonth;//$remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា } if($i!=1){ $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); }else{ $next_payment = $data['first_payment']; $next_payment = $dbtable->checkFirstHoliday($next_payment,$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); } $interest_paymonth = $data['total_amount']*($data['interest_rate']/100/$borrow_term)*$amount_day; // $interest_paymonth = $data['total_amount']*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm); }elseif($payment_method==3){//fixed rate $pri_permonth = ($data['total_amount']/($amount_borrow_term/$amount_fund_term)); $pri_permonth =$this->round_up_currency($curr_type,$pri_permonth); if($i!=1){ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា if($i==$loop_payment){//for end of record only $pri_permonth = $remain_principal; } $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); }else{ $next_payment = $data['first_payment']; $next_payment = $dbtable->checkFirstHoliday($next_payment,$data['every_payamount']); } $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $data['total_amount']*($data['interest_rate']/100/$borrow_term)*$amount_day; // $interest_paymonth = $data['total_amount']*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($day_perterm/$day_perterm); }elseif($payment_method==4){//fixed payment full last period yes if($i!=1){ $remain_principal = $remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); // $interest_paymonth = $data['total_amount']*($data['interest_rate']/100)*($amount_day/$day_perterm); }else{ $next_payment = $data['first_payment']; $next_payment = $dbtable->checkFirstHoliday($next_payment,$data['every_payamount']); } $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $remain_principal*($data['interest_rate']/100/$borrow_term)*$amount_day; $interest_paymonth = $this->round_up_currency($curr_type, $interest_paymonth); $pri_permonth = $data['amount_collect_pricipal']-$interest_paymonth; if($i==$loop_payment){//for end of record only $pri_permonth = $remain_principal; } }elseif($payment_method==5){//semi baloon//ok if($i!=1){ $ispay_principal++; $is_subremain++; $pri_permonth=0; if(($is_subremain-1)==$data['amount_collect_pricipal']){ $pri_permonth = ($data['total_amount']/$data['period'])*$data['amount_collect_pricipal']; $pri_permonth = $this->round_up_currency($curr_type, $pri_permonth); $is_subremain=1; } if(($ispay_principal-1)==$data['amount_collect_pricipal']+1){ $remain_principal = $remain_principal-($data['total_amount']/$data['period'])*$data['amount_collect_pricipal']; $ispay_principal=2; } if($i==$loop_payment){//check condition here//for end of record only $pri_permonth = $remain_principal; } $start_date = $next_payment; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $remain_principal*($data['interest_rate']/100/$borrow_term)*$amount_day; // $interest_paymonth = ($remain_principal*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($day_perterm/$day_perterm)); }else{ $pri_permonth = 0;//check if get pri first too much change; $next_payment = $data['first_payment']; $next_payment = $dbtable->checkFirstHoliday($next_payment,$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $data['total_amount']*($data['interest_rate']/100/$borrow_term)*$amount_day; // $interest_paymonth = ($data['total_amount']*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($day_perterm/$day_perterm)); } }else{// fixed payment with fixed rate if($i!=1){ $remain_principal = $remain_principal-$pri_permonth; $next_payment = $dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $this->round_up_currency($curr_type,$remain_principal*$irr_interest); $fixed_principal = round($total_loan_amount/$term_install,0, PHP_ROUND_HALF_DOWN); $pri_permonth = $fixed_principal-$interest_paymonth; if($i==$loop_payment){//for end of record only $pri_permonth = $remain_principal; $fixed_principal = round($total_loan_amount/$term_install,0, PHP_ROUND_HALF_DOWN); $fixed_principal= $this->round_up_currency($curr_type,$fixed_principal); $interest_paymonth = $fixed_principal-$remain_principal; } }else{ $fixed_principal = round($total_loan_amount/$term_install,0, PHP_ROUND_HALF_DOWN);//fixed $fixed_principal= $this->round_up_currency($curr_type,$fixed_principal); $post_fiexed = $total_loan_amount/$term_install-$fixed_principal; $total_payment_first = $this->round_up_currency($curr_type,$post_fiexed*$term_install); $pri_permonth = $fixed_principal+$total_payment_first; $next_payment = $dbtable->checkFirstHoliday($next_payment,$data['every_payamount']); $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); $interest_paymonth = $this->round_up_currency($curr_type,$loan_amount*($irr_interest)); $pri_permonth = ($fixed_principal+$total_payment_first)-$interest_paymonth; } } $old_remain_principal =$old_remain_principal+$remain_principal; $old_pri_permonth = $old_pri_permonth+$pri_permonth; $old_interest_paymonth = $this->round_up_currency($curr_type,($old_interest_paymonth+$interest_paymonth)); $old_amount_day =$old_amount_day+ $amount_day; if($data['amount_collect']==$amount_collect){ $datapayment = array( 'member_id'=>$member_id, 'total_principal'=>$remain_principal,//good 'principal_permonth'=> $old_pri_permonth,//good 'principle_after'=> $old_pri_permonth,//good 'total_interest'=>$old_interest_paymonth,//good 'total_interest_after'=>$old_interest_paymonth,//good 'total_payment'=>$old_pri_permonth+$old_interest_paymonth,//good 'total_payment_after'=>$old_pri_permonth+$old_interest_paymonth,//good 'date_payment'=>$next_payment,//good 'is_completed'=>0, 'branch_id'=>$data['branch_id'], 'status'=>1, 'amount_day'=>$old_amount_day, 'collect_by'=>$data['co_id'] ); $this->insert($datapayment); $amount_collect=0; $old_remain_principal = 0; $old_pri_permonth = 0; $old_interest_paymonth = 0; $old_amount_day = 0; $from_date=$next_payment; if($i!=1){ $next_payment = $dbtable->checkDefaultDate($str_next, $start_date, $data['amount_collect'],$data['every_payamount'],$data['first_payment']); } }else{ //if(){ the old record; //} //if record not cherk min smer 0 } $amount_collect++; } if(($amount_borrow_term)%($amount_fund_term)!=0){///end for record odd number only $start_date = $next_payment;//$dbtable->getNextPayment($str_next, $next_payment, $data['amount_collect'],$data['every_payamount']); $next_payment = $dbtable->checkFirstHoliday($data['date_line'],$data['every_payamount']); $amount_day = $amount_day = $dbtable->CountDayByDate($from_date,$next_payment); if($payment_method==1){ $pri_permonth = $remain_principal-$pri_permonth; // $pri_permonth*($amount_day/$amount_fund_term);//check it if khmer currency $interest_paymonth = $pri_permonth*($data['interest_rate']/100/$borrow_term)*$amount_day; $interest_paymonth = $this->round_up_currency($curr_type,$interest_paymonth); }elseif($payment_method==2){ $pri_permonth = $this->round_up_currency($curr_type, $pri_permonth); $remain_principal = $pri_permonth;//$remain_principal-$pri_permonth;//OSប្រាក់ដើមគ្រា $interest_paymonth = $pri_permonth*($data['interest_rate']/100/$borrow_term)*$amount_day; $interest_paymonth = $this->round_up_currency($curr_type,$interest_paymonth); }elseif($payment_method==3){ $pri_permonth = $remain_principal-$pri_permonth; $interest_paymonth = $data['total_amount']*($data['interest_rate']/100/$borrow_term)*$amount_day; // $interest_paymonth = ($data['total_amount']*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($day_perterm/$day_perterm)); $interest_paymonth = $this->round_up_currency($curr_type,$interest_paymonth); // $pri_permonth = $this->round_up_currency($curr_type,$pri_permonth); }elseif($payment_method==4){ $interest_paymonth = $data['total_amount']*($data['interest_rate']/100/$borrow_term)*$amount_day; // $interest_paymonth = ($data['total_amount']*((($amount_fund_term*$data['interest_rate'])/$borrow_term)/100)*($amount_day/$day_perterm)); $interest_paymonth = $this->round_up_currency($curr_type,$interest_paymonth); $pri_permonth = $remain_principal-$pri_permonth; }elseif($payment_method==5){ $pri_permonth = $remain_principal; $interest_paymonth = $remain_principal*($data['interest_rate']/100/$borrow_term)*$amount_day; $interest_paymonth = $this->round_up_currency($curr_type,$interest_paymonth); }elseif($payment_method==6){ $interest_paymonth = $this->round_up_currency($curr_type,$remain_principal*$irr_interest); $fixed_principal = round($total_loan_amount/$term_install,0, PHP_ROUND_HALF_DOWN); $pri_permonth = $remain_principal; } $datapayment = array( 'member_id'=>$member_id, 'total_principal'=>$pri_permonth,//good 'principal_permonth'=> $pri_permonth,//good 'principle_after'=> $old_pri_permonth,//good 'total_interest'=>$interest_paymonth,//good 'total_interest_after'=>$interest_paymonth,//good 'total_payment'=>$interest_paymonth+$pri_permonth,//good 'total_payment_after'=>$old_pri_permonth+$old_interest_paymonth,//good 'date_payment'=>$next_payment,//good 'is_completed'=>0, 'branch_id'=>$data['branch_id'], 'status'=>1, 'amount_day'=>$amount_day, 'collect_by'=>$data['co_id'] ); $this->insert($datapayment); } $db->commit(); return 1; }catch (Exception $e){ $db->rollBack(); Application_Form_FrmMessage::message("INSERT_FAIL"); Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage()); } }
public function FrmAddLoan($data=null){ $_isgroup = new Zend_Dojo_Form_Element_CheckBox('is_group'); $_isgroup->setAttribs(array( 'dojoType'=>'dijit.form.CheckBox', 'class'=>'fullside', // 'onkeyup'=>'Calcuhundred()' )); $_loan_code = new Zend_Dojo_Form_Element_TextBox('loan_code'); $_loan_code->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'readonly'=>true, 'style'=>'color:red; font-weight: bold;' )); $db = new Application_Model_DbTable_DbGlobal(); $loan_number = $db->getLoanNumber(); $_loan_code->setValue($loan_number); $_loan_codes = new Zend_Dojo_Form_Element_TextBox('loan_codes'); $_loan_codes->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'readonly'=>true, 'style'=>'color:red; font-weight: bold;' )); // $loan_numbers = $db->getLoanNumber(); // $_loan_codes->setValue($loan_numbers); $_client_code = new Zend_Dojo_Form_Element_TextBox('client_code'); $_client_code->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', )); $_client_codes = new Zend_Dojo_Form_Element_TextBox('client_codes'); $_client_codes->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', )); $_group_code = new Zend_Dojo_Form_Element_FilteringSelect('group_code'); $_group_code->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'getmemberIdGroup();' )); // $group_opt = $db ->getGroupCodeById(1,1,1); // $_group_code->setMultiOptions($group_opt); $get_laonnumber = new Zend_Dojo_Form_Element_FilteringSelect('get_laonnumber'); $get_laonnumber->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'getInfoByLoanNumber();getLoanInfoByLoanNumber();' )); $group_opt = $db->getLoanAllLoanNumber(1,1); $get_laonnumber->setMultiOptions($group_opt); $schedule_opt = new Zend_Dojo_Form_Element_FilteringSelect('reschedule_opt'); $schedule_opt->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', )); $opt = $db->getVewOptoinTypeByType(25,1,null,1); $schedule_opt->setMultiOptions($opt); $dbs = new Loan_Model_DbTable_DbLoanIL(); $_customer_code = new Zend_Dojo_Form_Element_FilteringSelect('customer_code'); $_customer_code->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'showPopupclient;' )); // $group_opt = $dbs ->getClient(1);//code,individual,option $group_opt = $db->getGroupCodeById(1,0,1);//code,individual,option $_customer_code->setMultiOptions($group_opt); $_customer_codes = new Zend_Dojo_Form_Element_TextBox('customer_codes'); $_customer_codes->setAttribs(array( 'dojoType'=>'dijit.form.textbox', 'class'=>'fullside', 'onchange'=>'showPopupclient;' )); // $group_opt = $dbs ->getClient(1);//code,individual,option // $_member = new Zend_Dojo_Form_Element_FilteringSelect('member'); // $_member->setAttribs(array( // 'dojoType'=>'dijit.form.FilteringSelect', // 'class'=>'fullside', // 'onchange'=>'showPopupclient();' // )); // $options = $db->getGroupCodeById(2,0,1); // $_member->setMultiOptions($options); $_members = new Zend_Dojo_Form_Element_TextBox('members'); $_members->setAttribs(array( 'dojoType'=>'dijit.form.textbox', 'class'=>'fullside', //'onchange'=>'showPopupclient();' )); // $options = $dbs->getClient(2); $_groupid = new Zend_Dojo_Form_Element_FilteringSelect('group_id'); $_groupid->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'popupCheckClient();' )); // $options = $db->getGroupCodeById(2,1,1);//show name,show group,show option // $_groupid->setMultiOptions($options); $_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id'); $_coid->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'popupCheckCO();' )); $options = $db ->getAllCOName(1); $_coid->setMultiOptions($options); $_coids = new Zend_Dojo_Form_Element_FilteringSelect('co_ids'); $_coids->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'popupCheckCO();' )); $optionss = $db ->getAllCOName(1); $_coids->setMultiOptions($optionss); $_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type'); $_currency_type->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', )); // $opt = array(2=>"Dollar",1=>'Khmer',3=>"Bath"); $opt = $db->getVewOptoinTypeByType(15,1,3,1); $_currency_type->setMultiOptions($opt); $_currency_type->setValue(2); $_loan_type = new Zend_Dojo_Form_Element_FilteringSelect('loan_type'); $_loan_type->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onChange'=>'loantype();' )); $opt = $db->getVewOptoinTypeByType(24,1,null,1); $opt[-1]="--- Add New---"; $_loan_type->setMultiOptions($opt); $_loan_types = new Zend_Dojo_Form_Element_FilteringSelect('loan_types'); $_loan_types->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onChange'=>'loantype();' )); $opts = $db->getVewOptoinTypeByType(24,1,null,1); $opt[-1]="--- Add New---"; $_loan_types->setMultiOptions($opts); $_zone = new Zend_Dojo_Form_Element_FilteringSelect('zone'); $_zone->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'zone();' )); $options = $db ->getZoneList(1); $options[-1]="--- Add New---"; $_zone->setMultiOptions($options); $_zones = new Zend_Dojo_Form_Element_FilteringSelect('zones'); $_zones->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'zone();' )); $optionsf = $db ->getZoneList(1); $optionsf[-1]="--- Add New---"; $_zones->setMultiOptions($optionsf); $_loan_fee = new Zend_Dojo_Form_Element_NumberTextBox('loan_fee'); $_loan_fee->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required'=>true )); $_loan_fee->setValue(0); $_loan_fees = new Zend_Dojo_Form_Element_NumberTextBox('loan_fees'); $_loan_fees->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required'=>true )); $_loan_fees->setValue(0); $_other_fee = new Zend_Dojo_Form_Element_NumberTextBox('other_fee'); $_other_fee->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required'=>true, )); $_other_fee->setValue(0); $_other_fees = new Zend_Dojo_Form_Element_NumberTextBox('other_fees'); $_other_fees->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required'=>true, )); $_other_fees->setValue(0); $_time_collect = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect'); $_time_collect->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'onkeyup'=>'getFirstPayment();' )); $_time_collect->setValue(1); $_time_collect_pri = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect_pricipal'); $_time_collect_pri->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'readonly'=>true, 'required'=>true )); $_time_collect_pri->setValue(0); $dbs = new Loan_Model_DbTable_DbLoanss(); $_amount = new Zend_Dojo_Form_Element_NumberTextBox('total_amount'); $_amount->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true', 'onkeyup'=>'calCulateAdminFee();' )); $_level = new Zend_Dojo_Form_Element_NumberTextBox('level'); $_level->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_level->setValue(1); $_levels = new Zend_Dojo_Form_Element_NumberTextBox('levels'); $_levels->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_levels->setValue(1); $_rate = new Zend_Dojo_Form_Element_NumberTextBox("interest_rate"); $_rate->setAttribs(array( 'data-dojo-Type'=>'dijit.form.NumberTextBox', 'data-dojo-props'=>" 'required':true, 'name':'interest_rate', 'value':2.5, 'class':'fullside', 'invalidMessage':'អាចបញ្ជូលពី 1 ដល់' ")); $_period = new Zend_Dojo_Form_Element_NumberTextBox('period'); $_period->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true', 'onkeyup'=>'calCulatePeriod();' )); $_period->setValue(12); $_releasedate = new Zend_Dojo_Form_Element_DateTextBox('release_date'); $_releasedate->setAttribs(array( 'dojoType'=>'dijit.form.DateTextBox', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'checkReleaseDate();' )); $s_date = date('Y-m-d'); $_releasedate->setValue($s_date); $_first_payment = new Zend_Dojo_Form_Element_DateTextBox('first_payment'); $_first_payment->setAttribs(array( 'dojoType'=>'dijit.form.DateTextBox', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'calCulateEndDate();' )); //$_first_payment->setValue('2005-12-30'); $_dateline = new Zend_Dojo_Form_Element_DateTextBox('date_line'); $_dateline->setAttribs(array( 'dojoType'=>'dijit.form.DateTextBox', 'class'=>'fullside', 'required' =>'true', 'readonly'=>true, )); $_graice_pariod = new Zend_Dojo_Form_Element_TextBox('graice_pariod'); $_graice_pariod->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'required'=>'true', 'onKeyup'=>'CompareGraicePariod();' //'readOnly'=>true, )); $_graice_pariod->setValue(0); $_collect_term = new Zend_Dojo_Form_Element_FilteringSelect('collect_termtype'); $_collect_term->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'changeGraicePeroid();' )); $term_opt = $db->getVewOptoinTypeByType(14,1,3,1); $_collect_term->setMultiOptions($term_opt); $_payterm = new Zend_Dojo_Form_Element_FilteringSelect('payment_term'); $_payterm->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); $_payterm->setMultiOptions($term_opt); $_pay_every = new Zend_Dojo_Form_Element_FilteringSelect('pay_every'); $_pay_every->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'changeCollectType();' )); // $options= array(1=>"Day",2=>"Week",3=>"Month"); // $_pay_every->setMultiOptions($options); $_pay_every->setValue(3); $_pay_every->setMultiOptions($term_opt); $_every_payamount = new Zend_Dojo_Form_Element_FilteringSelect('every_payamount'); $_every_payamount->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); $options= array(2=>"After",1=>"Before",3=>"Normal"); $_every_payamount->setMultiOptions($options); $_time= new Zend_Dojo_Form_Element_TextBox('time'); $_time->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', )); $set_time='10:00-11:00 AM'; $_time->setValue($set_time); $_paybefore = new Zend_Dojo_Form_Element_NumberTextBox('pay_before'); $_paybefore->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_paybefore->setValue(0); $_pay_late = new Zend_Dojo_Form_Element_NumberTextBox('pay_late'); $_pay_late->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_pay_late->setValue(0); $arr=$db->getSystemSetting('interest_late'); $_pay_late->setValue($arr['value']); // print_r($arr);exit(); $_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id'); $_branch_id->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'filterClient();' )); $rows = $db->getAllBranchName(); $options=array(''=>'---Select Branch---'); if(!empty($rows))foreach($rows AS $row){ $options[$row['br_id']]=$row['branch_namekh']; } $_branch_id->setMultiOptions($options); // $_branch_ids = new Zend_Dojo_Form_Element_FilteringSelect('branch_ids'); // $_branch_ids->setAttribs(array( // 'dojoType'=>'dijit.form.FilteringSelect', // 'class'=>'fullside', // 'required' =>'true', // 'onchange'=>'filterClient();' // )); // $rows = $db->getAllBranchName(); // $optionsa=array(''=>'---Select Branch---'); // if(!empty($rows))foreach($rows AS $row){ // $optionsa[$row['br_id']]=$row['branch_namekh']; // } // $_branch_ids->setMultiOptions($optionsa); $_repayment_method = new Zend_Dojo_Form_Element_FilteringSelect('repayment_method'); $_repayment_method->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'chechPaymentMethod()' )); $options = $db->getAllPaymentMethod(null,1); $_repayment_method->setMultiOptions($options); $_status = new Zend_Dojo_Form_Element_FilteringSelect('status_using'); $_status->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); // $options= array(1=>"Befor",2=>"After",3=>"Cancel"); $options= array(1=>"Active",0=>"Cancel"); $_status->setMultiOptions($options); $_interest = new Zend_Dojo_Form_Element_TextBox("interest"); $_interest->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'required' =>'true' )); $penalize = new Zend_Dojo_Form_Element_TextBox("penalize"); $penalize->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'required' =>'true' )); $_service_charge = new Zend_Dojo_Form_Element_TextBox("service_charge"); $_service_charge->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'required' =>'true' )); $_instalment_date = new Zend_Form_Element_Hidden("instalment_date"); $_release_date = new Zend_Form_Element_Hidden("old_release_date"); $_interest_rate = new Zend_Form_Element_Hidden("old_rate"); $_old_payterm = new Zend_Form_Element_Hidden("old_payterm"); $_id = new Zend_Form_Element_Hidden('id'); if($data!=null){ // print_r($data); $_branch_id->setValue($data['branch_id']); $_loan_code->setValue($data['loan_number']); $_level->setValue($data['level']); $_loan_fee->setValue($data['admin_fee']); $_other_fee->setValue($data['other_fee']); // $_member->setValue($data['client_id']); $_customer_code->setValue($data['client_id']); $_coid->setValue($data['co_id']); $_zone->setValue($data['zone_id']); $_releasedate->setValue($data['date_release']); $_period->setValue($data['total_duration']); $_first_payment->setValue($data['first_payment']); $_time->setValue($data['time_collect']); $_every_payamount->setValue($data['holiday']); $_amount->setValue($data['total_capital']); $_currency_type->setValue($data['currency_type']); $_rate->setValue($data['interest_rate']);// $_rate->setAttribs(array( 'data-dojo-props'=>" 'value':'".$data['interest_rate']."'")); $_repayment_method->setValue($data['payment_method']); $_graice_pariod->setValue($data['graice_period']); $_time_collect_pri->setValue($data['semi']); $_dateline->setValue($data['date_line']); $_pay_every->setValue($data['pay_term']); $_time_collect->setValue($data['amount_collect_principal']); $_collect_term->setValue($data['collect_typeterm']); $_pay_late->setValue($data['pay_after']); $_paybefore->setValue($data['pay_before']); $_id->setValue($data['g_id']); $_group_code->setValue($data['client_id']); // $_groupid->setValue($data['client_id']); $get_laonnumber->setvalue($data['g_id']); $_status->setValue($data['status']); // print_r($data); } $this->addElements(array($_groupid,$_old_payterm,$_interest_rate,$_release_date,$_instalment_date,$_interest,$penalize,$_service_charge,$schedule_opt,$_loan_types,$_loan_fees,$_other_fees,$_zones ,$_client_codes,$_loan_codes,$_members,$_customer_codes,$_levels,$_coids,$get_laonnumber,$_loan_type, $_other_fee,$_isgroup,$_client_code,$_time_collect,$_loan_fee,$_level,$_paybefore, $_pay_late,$_branch_id,$_coid,$_currency_type,$_zone,$_amount,$_rate,$_releasedate ,$_payterm,$_every_payamount,$_time,$_time_collect_pri,$_status,$_graice_pariod,$_period, $_first_payment,$_repayment_method,$_pay_every,$_loan_code,$_collect_term,$_dateline, $_group_code,$_customer_code,$_id)); return $this; }
public function FrmAddLoan($data=null){ $_isgroup = new Zend_Dojo_Form_Element_CheckBox('is_group'); $_isgroup->setAttribs(array( 'dojoType'=>'dijit.form.CheckBox', 'class'=>'fullside', // 'onkeyup'=>'Calcuhundred()' )); $_loan_code = new Zend_Dojo_Form_Element_TextBox('loan_code'); $_loan_code->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'readonly'=>true, 'style'=>'color:red; font-weight: bold;' )); $db = new Application_Model_DbTable_DbGlobal(); $loan_number = $db->getLoanNumber(); $_loan_code->setValue($loan_number); $_client_code = new Zend_Dojo_Form_Element_TextBox('client_code'); $_client_code->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', )); $_group_code = new Zend_Dojo_Form_Element_FilteringSelect('group_code'); $_group_code->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'getmemberIdGroup();' )); $group_opt = $db ->getGroupCodeById(1,1,1); $_group_code->setMultiOptions($group_opt); $dbs = new Loan_Model_DbTable_DbLoanss(); $_customer_code = new Zend_Dojo_Form_Element_FilteringSelect('customer_code'); $_customer_code->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'getClientInfo(1);' )); $group_opt = $dbs ->getClientByTypes(1);//code,individual,option $_customer_code->setMultiOptions($group_opt); $_member = new Zend_Dojo_Form_Element_FilteringSelect('member'); $_member->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'getClientInfo(2)' )); $options = $dbs->getClientByTypes(2); $_member->setMultiOptions($options); $db = new Application_Model_DbTable_DbGlobal(); $_groupid = new Zend_Dojo_Form_Element_FilteringSelect('group_id'); $_groupid->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'popupCheckClient();' )); $options = $db ->getGroupCodeById(2,1,1);//show name,show group,show option $_groupid->setMultiOptions($options); $_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id'); $_coid->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'popupCheckCO();' )); $options = $db ->getAllCOName(1); $_coid->setMultiOptions($options); $_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type'); $_currency_type->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', )); $opt = array(2=>"Dollar",1=>'Khmer',3=>"Bath"); // $opt = $db->getVewOptoinTypeByType(15,1,3); $_currency_type->setMultiOptions($opt); $_zone = new Zend_Dojo_Form_Element_FilteringSelect('zone'); $_zone->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'popupCheckZone();' )); $options = $db ->getZoneList(1); $_zone->setMultiOptions($options); $_loan_fee = new Zend_Dojo_Form_Element_NumberTextBox('loan_fee'); $_loan_fee->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', )); $_loan_fee->setValue(0); $_time_collect = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect'); $_time_collect->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'onkeyup'=>'getFirstPayment();' )); $_time_collect->setValue(1); $_time_collect_pri = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect_pricipal'); $_time_collect_pri->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'readonly'=>true, 'required'=>true )); $_time_collect_pri->setValue(2); $dbs = new Loan_Model_DbTable_DbLoanss(); $_amount = new Zend_Dojo_Form_Element_NumberTextBox('total_amount'); $_amount->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_level = new Zend_Dojo_Form_Element_NumberTextBox('level'); $_level->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_level->setValue(1); $_rate = new Zend_Dojo_Form_Element_ValidationTextBox("interest_rate"); $_rate->setAttribs(array( 'data-dojo-Type'=>'dijit.form.ValidationTextBox', 'data-dojo-props'=>" 'required':true, 'name':'interest_rate', 'value':2.5, 'class':'fullside', 'invalidMessage':'អាចបញ្ជូលពី 1 ដល់ '")); $_period = new Zend_Dojo_Form_Element_NumberTextBox('period'); $_period->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true', 'onkeyup'=>'calCulatePeriod();' )); $_period->setValue(12); $_releasedate = new Zend_Dojo_Form_Element_DateTextBox('release_date'); $_releasedate->setAttribs(array( 'dojoType'=>'dijit.form.DateTextBox', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'checkReleaseDate();' )); $s_date = date('Y-m-d'); $_releasedate->setValue($s_date); $_first_payment = new Zend_Dojo_Form_Element_DateTextBox('first_payment'); $_first_payment->setAttribs(array( 'dojoType'=>'dijit.form.DateTextBox', 'class'=>'fullside', 'required' =>'true', //'onchange'=>'calCulateFirstPayment();' )); //$_first_payment->setValue('2005-12-30'); $_dateline = new Zend_Dojo_Form_Element_DateTextBox('date_line'); $_dateline->setAttribs(array( 'dojoType'=>'dijit.form.DateTextBox', 'class'=>'fullside', 'required' =>'true', 'readonly'=>true, )); $_graice_pariod = new Zend_Dojo_Form_Element_TextBox('graice_pariod'); $_graice_pariod->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', 'required'=>'true', 'onKeyup'=>'CompareGraicePariod();' //'readOnly'=>true, )); $_graice_pariod->setValue(0); $_collect_term = new Zend_Dojo_Form_Element_FilteringSelect('collect_termtype'); $_collect_term->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'onchange'=>'changeGraicePeroid();' )); $term_opt = $db->getVewOptoinTypeByType(1,1,3); $_collect_term->setMultiOptions($term_opt); $_payterm = new Zend_Dojo_Form_Element_FilteringSelect('payment_term'); $_payterm->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); // $options= array(1=>"Day",2=>"Week",3=>"Month"); // $_payterm->setMultiOptions($options); $_payterm->setMultiOptions($term_opt); $_pay_every = new Zend_Dojo_Form_Element_FilteringSelect('pay_every'); $_pay_every->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'changeCollectType();' )); // $options= array(1=>"Day",2=>"Week",3=>"Month"); // $_pay_every->setMultiOptions($options); $_pay_every->setValue(3); $_pay_every->setMultiOptions($term_opt); $_every_payamount = new Zend_Dojo_Form_Element_FilteringSelect('every_payamount'); $_every_payamount->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); $options= array(2=>"After",1=>"Before",3=>"Normal"); $_every_payamount->setMultiOptions($options); $_time= new Zend_Dojo_Form_Element_TextBox('time'); $_time->setAttribs(array( 'dojoType'=>'dijit.form.TextBox', 'class'=>'fullside', )); $set_time='10:00-11:00 AM'; $_time->setValue($set_time); $_paybefore = new Zend_Dojo_Form_Element_NumberTextBox('pay_before'); $_paybefore->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_paybefore->setValue(0); $_pay_late = new Zend_Dojo_Form_Element_NumberTextBox('pay_late'); $_pay_late->setAttribs(array( 'dojoType'=>'dijit.form.NumberTextBox', 'class'=>'fullside', 'required' =>'true' )); $_pay_late->setValue(0); $_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id'); $_branch_id->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); $rows = $db->getAllBranchName(); $options=''; if(!empty($rows))foreach($rows AS $row){ $options[$row['br_id']]=$row['branch_namekh']; } $_branch_id->setMultiOptions($options); $_repayment_method = new Zend_Dojo_Form_Element_FilteringSelect('repayment_method'); $_repayment_method->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true', 'onchange'=>'chechPaymentMethod()' )); $options = $db->getAllPaymentMethod(null,1); $_repayment_method->setMultiOptions($options); $_holiday = new Zend_Dojo_Form_Element_FilteringSelect('holiday'); $_holiday->setAttribs(array( 'dojoType'=>'dijit.form.FilteringSelect', 'class'=>'fullside', 'required' =>'true' )); $options= array(1=>"Befor",2=>"After",3=>"Cancel"); $_holiday->setMultiOptions($options); $_id = new Zend_Form_Element_Hidden('id'); if($data!=null){ // print_r($data); $_branch_id->setValue($data['branch_id']); $_loan_code->setValue($data['loan_number']); $_level->setValue($data['level']); $_loan_fee->setValue($data['admin_fee']); $_member->setValue($data['client_id']); $_customer_code->setValue($data['client_id']); $_coid->setValue($data['co_id']); $_zone->setValue($data['zone_id']); $_releasedate->setValue($data['date_release']); $_period->setValue($data['total_duration']); $_first_payment->setValue($data['first_payment']); $_time->setValue($data['time_collect']); $_every_payamount->setValue($data['holiday']); $_amount->setValue($data['total_capital']); $_currency_type->setValue($data['currency_type']); $_rate->setValue($data['interest_rate']);// $_rate->setAttribs(array( 'data-dojo-props'=>" 'value':'".$data['interest_rate']."'")); $_repayment_method->setValue($data['payment_method']); $_graice_pariod->setValue($data['graice_period']); $_time_collect_pri->setValue($data['semi']); $_dateline->setValue($data['date_line']); $_pay_every->setValue($data['pay_term']); $_time_collect->setValue($data['amount_collect_principal']); $_collect_term->setValue($data['collect_typeterm']); $_pay_late->setValue($data['pay_after']); $_paybefore->setValue($data['pay_before']); $_id->setValue($data['g_id']); $_group_code->setValue($data['client_id']); $_groupid->setValue($data['client_id']); // print_r($data); } $this->addElements(array($_isgroup,$_groupid,$_client_code,$_time_collect,$_loan_fee,$_level,$_paybefore,$_pay_late,$_branch_id,$_member,$_coid,$_currency_type,$_zone,$_amount,$_rate,$_releasedate ,$_payterm,$_every_payamount,$_time,$_time_collect_pri,$_holiday,$_graice_pariod,$_period, $_first_payment,$_repayment_method,$_pay_every,$_loan_code,$_collect_term,$_dateline, $_group_code,$_customer_code,$_id)); return $this; }
public function FrmAddLoan($data = null) { $_isgroup = new Zend_Dojo_Form_Element_CheckBox('is_group'); $_isgroup->setAttribs(array('dojoType' => 'dijit.form.CheckBox', 'class' => 'fullside')); $_loan_code = new Zend_Dojo_Form_Element_TextBox('loan_code'); $_loan_code->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'readonly' => true, 'style' => 'color:red; font-weight: bold;')); $db = new Application_Model_DbTable_DbGlobal(); $loan_number = $db->getLoanNumber(); $_loan_code->setValue($loan_number); $_collect_term = new Zend_Dojo_Form_Element_FilteringSelect('collect_termtype'); $_collect_term->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'changeGraicePeroid();')); $term_opt = $db->getVewOptoinTypeByType(1, 1, 3); $_collect_term->setMultiOptions($term_opt); $_client_code = new Zend_Dojo_Form_Element_TextBox('client_code'); $_client_code->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside')); $_groupid = new Zend_Dojo_Form_Element_FilteringSelect('group_id'); $_groupid->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'popupCheckClient();')); $rows = $db->getClientByType(1); $options = array('' => "------Select------", -1 => "Add New new group"); if (!empty($rows)) { foreach ($rows as $row) { $options[$row['client_id']] = $row['name_en'] . ',' . $row['province_en_name'] . ',' . $row['district_name'] . ',' . $row['commune_name'] . ',' . $row['village_name']; } } $_groupid->setMultiOptions($options); $_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id'); $rows = $db->getAllCOName(); $options = array('' => "------Select------", -1 => "Add New"); if (!empty($rows)) { foreach ($rows as $row) { $options[$row['co_id']] = $row['co_khname']; } } $_coid->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'popupCheckCO();')); $_coid->setMultiOptions($options); $_member = new Zend_Dojo_Form_Element_FilteringSelect('member'); $_member->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside')); $rows = $db->getClientByType(); $options = array('' => "------Select------", -1 => "Add New"); if (!empty($rows)) { foreach ($rows as $row) { $options[$row['client_id']] = $row['name_en']; } } $_member->setMultiOptions($options); $_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type'); $_currency_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside')); $opt = array(2 => "Dollar", 1 => 'Khmer', 3 => "Bath"); $_currency_type->setMultiOptions($opt); $_zone = new Zend_Dojo_Form_Element_FilteringSelect('zone'); $_zone->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'popupCheckZone();')); $rows = $db->getZoneList(); $options = array('' => "------Select------", -1 => "Add New"); if (!empty($rows)) { foreach ($rows as $row) { $options[$row['zone_id']] = $row['zone_name']; } } $_zone->setMultiOptions($options); $_loan_fee = new Zend_Dojo_Form_Element_NumberTextBox('loan_fee'); $_loan_fee->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside')); $_loan_fee->setValue(0); $_time_collect = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect'); $_time_collect->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'onkeyup' => 'getFirstPayment();')); $_time_collect->setValue(1); $_time_collect_pri = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect_pricipal'); $_time_collect_pri->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'readonly' => true, 'required' => true)); $_time_collect_pri->setValue(2); $_amount = new Zend_Dojo_Form_Element_NumberTextBox('total_amount'); $_amount->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true')); $_level = new Zend_Dojo_Form_Element_NumberTextBox('level'); $_level->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true')); $_level->setValue(1); // $_rate = new Zend_Dojo_Form_Element_NumberTextBox('interest_rate'); // $_rate->setAttribs(array( // 'data-dojo-Type'=>'dijit.form.NumberTextBox', // 'data-dojo-props'=>"regExp:'[0-9]{1,2}', // 'required':true, // 'name':'batch', // 'value':2.5, // 'class':'fullside', // 'invalidMessage':'អាចបញ្ជូលពី 1 ដល់ 99'")); $_rate = new Zend_Dojo_Form_Element_ValidationTextBox("interest_rate"); $_rate->setAttribs(array('data-dojo-Type' => 'dijit.form.ValidationTextBox', 'data-dojo-props' => "\r\n\t\t\t\t'required':true,\r\n\t\t\t\t'name':'interest_rate',\r\n\t\t\t\t'value':2.5,\r\n\t\t\t\t'class':'fullside',\r\n\t\t\t\t'invalidMessage':'អាចបញ្ជូលពី 1 ដល់ 100'")); // $value_interest = 2.5; // $_rate->setValue($value_interest); $_period = new Zend_Dojo_Form_Element_NumberTextBox('period'); $_period->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true', 'onkeyup' => 'calCulatePeriod();')); $_period->setValue(12); $_releasedate = new Zend_Dojo_Form_Element_DateTextBox('release_date'); $_releasedate->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => 'true', 'onchange' => 'checkReleaseDate();')); $s_date = date('Y-m-d'); $_releasedate->setValue($s_date); $_first_payment = new Zend_Dojo_Form_Element_DateTextBox('first_payment'); $_first_payment->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => 'true')); //$_first_payment->setValue('2005-12-30'); $_dateline = new Zend_Dojo_Form_Element_DateTextBox('date_line'); $_dateline->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => 'true', 'readonly' => true)); $_graice_pariod = new Zend_Dojo_Form_Element_TextBox('graice_pariod'); $_graice_pariod->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'required' => 'true')); $_graice_pariod->setValue(0); $_payterm = new Zend_Dojo_Form_Element_FilteringSelect('payment_term'); $_payterm->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true')); $options = array(1 => "Day", 2 => "Week", 3 => "Month"); $_payterm->setMultiOptions($options); $_pay_every = new Zend_Dojo_Form_Element_FilteringSelect('pay_every'); $_pay_every->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true', 'onchange' => 'changeCollectType();')); $options = array(1 => "Day", 2 => "Week", 3 => "Month"); $_pay_every->setMultiOptions($options); $_pay_every->setValue(3); $_every_payamount = new Zend_Dojo_Form_Element_FilteringSelect('every_payamount'); $_every_payamount->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true')); $options = array(2 => "After", 1 => "Before", 3 => "Normal"); $_every_payamount->setMultiOptions($options); $_time = new Zend_Dojo_Form_Element_TextBox('time'); $_time->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside')); $set_time = '10:00-11:00 AM'; $_time->setValue($set_time); $_paybefore = new Zend_Dojo_Form_Element_NumberTextBox('pay_before'); $_paybefore->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true')); $_paybefore->setValue(0); $_pay_late = new Zend_Dojo_Form_Element_NumberTextBox('pay_late'); $_pay_late->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true')); $_pay_late->setValue(0); $_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id'); $_branch_id->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true')); $rows = $db->getAllBranchName(); $options = ''; if (!empty($rows)) { foreach ($rows as $row) { $options[$row['br_id']] = $row['branch_namekh']; } } $_branch_id->setMultiOptions($options); $_repayment_method = new Zend_Dojo_Form_Element_FilteringSelect('repayment_method'); $_repayment_method->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true', 'onchange' => 'chechPaymentMethod()')); //$options= array(1=>"Decline",2=>"Baloon",3=>"Fixed Rate",4=>"Fixed Payment",5=>"Semi Baloon"); // $options= array( // 1=>"Decline", // 2=>"Baloon", // 3=>"Fixed Rate", // 4=>"Fixed Pyment(Full Last Period)", // 5=>"Semi Baloon", // 6=>"Fixed Payment (Fixed Rate)"); $options = $db->getAllPaymentMethod(null, 1); $_repayment_method->setMultiOptions($options); $_holiday = new Zend_Dojo_Form_Element_FilteringSelect('holiday'); $_holiday->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true')); $options = array(1 => "Befor", 2 => "After", 3 => "Cancel"); $_holiday->setMultiOptions($options); if ($data != null) { print_r($data); $_branch_id->setValue($data['member_id']); $_level->setValue($data['level']); $_loan_fee->setValue($data['admin_fee']); $_member->setValue($data['client_id']); $_coid->setValue($data['co_id']); $_zone->setValue($data['zone_id']); $_releasedate->setValue($data['date_release']); $_period->setValue($data['zone_id']); $_first_payment->setValue($data['zone_id']); $_time->setValue($data['time_collect']); $_every_payamount->setValue($data['pay_term']); $_amount->setValue($data['total_capital']); $_currency_type->setValue($data['payment_method']); $_rate->setValue($data['zone_id']); $_repayment_method->setValue($data['payment_method']); $_graice_pariod->setValue($data['graice_pariod']); $_time_collect_pri->setValue($data['amount_collect_pricipal']); } $this->addElements(array($_isgroup, $_groupid, $_client_code, $_time_collect, $_loan_fee, $_level, $_paybefore, $_pay_late, $_branch_id, $_member, $_coid, $_currency_type, $_zone, $_amount, $_rate, $_releasedate, $_payterm, $_every_payamount, $_time, $_time_collect_pri, $_holiday, $_graice_pariod, $_period, $_first_payment, $_repayment_method, $_pay_every, $_loan_code, $_collect_term, $_dateline)); return $this; }
function getloannumberAction(){ if($this->getRequest()->isPost()){ $data = $this->getRequest()->getPost(); $db = new Application_Model_DbTable_DbGlobal(); $loan_number = $db->getLoanNumber($data); print_r(Zend_Json::encode($loan_number)); exit(); } }