猿问

如果某些行仍未支付,则收集的金额在每一行中重复

当为特定费用类型收取金额时,发票行在每个费用类型行下方重复,发票行只需要显示在已支付费用类型下方。请参考下图。


控制器:


public function issueAdvance($company_id){

  if($this->session->userdata("is_active") == 1){

    $seedIssue =$this->seed_issue_model->selectFarmer($company_id);

    $singlefarmer =$this->seed_issue_model->selectIssueDates($company_id);

    $crops = $this->seed_issue_model->get_crop_data(); //Crop

    $pc_code = $this->seed_issue_model->get_pc_data(); //Production-Code

    $advance_amount =$this->advance_model->getLoanData($company_id);

    $paid_installments = $this->advance_model->paidInstallments($company_id);

    if ($this->input->server('REQUEST_METHOD') == "GET") {

        $data = array(

           "page_content" => "advance/view_advance_issue",

           "singleFarmer" =>$singlefarmer,

           "issueSeed"  =>$seedIssue,

           "crop_result" =>$crops,

           "pc_result" =>$pc_code,

           "farmer_loan" =>$advance_amount,

           "paid_installments" =>$paid_installments

        );

        $this->load->view("layout/main_layout",$data);

     } else{

             

     }

   }

}

模型:


public function getLoanData($company_id){

  $query = $this->db->select('a1.farmer_id,a1.advance_id,b1.balance_id,a1.amount,a1.check_no,a1.given_date,a1.due_date,b1.reason,b1.season,b1.mode,b1.balance')

   ->from('tbl_advance as a1')

   ->join('tbl_balance as b1', 'b1.advance_id=a1.advance_id')

   ->where("a1.farmer_id", $company_id)

   ->order_by('a1.given_date', 'desc')

   ->get();

   $result = $query->result();

   return $result;

}

public function paidInstallments($company_id){

  $query = $this->db->select('a1.farmer_id,a1.advance_id,b1.balance_id,p1.amount_paid,p1.amount_discount,p1.paying_date,p1.payment_id,p1.payment_mode,p1.description,p1.balance_id')

   ->from('tbl_pay_amount as p1')

   ->join('tbl_balance as b1', 'p1.balance_id=b1.balance_id')

   ->join('tbl_advance as a1', 'b1.advance_id=a1.advance_id','p1.advance_id=a1.advance_id') 

   ->where("a1.farmer_id", $company_id)

   ->get();

   $result = $query->result(); 

   return $result;

}


互换的青春
浏览 79回答 1
1回答

慕容3067478

您在循环$value内使用相同的变量名,这可能会与外部变量发生冲突。foreach ($paid_installments as $index => $value)所以将其更改为一些不同的名称,例如$pvalue. 并在循环内添加一张支票,例如foreach ($paid_installments as $index => $pvalue) {&nbsp; &nbsp; &nbsp; &nbsp; if($value->advance_id != $pvalue->advance_id )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;&nbsp; &nbsp; &nbsp; &nbsp; ?>&nbsp; &nbsp; &nbsp; &nbsp; <tr class="white-td" id="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td align="left"></td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td align="left"></td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td align="left"></td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td align="left"></td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td align="left"></td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td class="text text-left">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="#" data-toggle="popover" class="detail_popover" > <?php echo $pvalue->payment_id; ?></a>&nbsp; &nbsp; &nbsp; &nbsp; //...&nbsp; &nbsp; &nbsp; &nbsp; //..&nbsp;
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答