自定义构建数据源
PrepaymentController.php
foreach ($Invoice_arr as $arr)
$rawData[]=array('invoiceID'=>$arr['invoiceID'],'invoiceNO'=>$arr['invoiceNO'],'recordDate'=>$arr['recordDate'],'invoiceTo'=>$arr['invoiceTo'],'finishDate'=>$arr['finishDate'],'paymentDate'=>$arr['paymentDate'],'clientID'=>$arr['clientID']
);
'id'=>'report',
'sort'=>array(
'attributes'=>array(
'purchaseID','purchaseNO','recordDate','vendorID','finishDate','clientID'
),
),
'pagination'=>array(
// 'pageSize'=>10,
'pageSize'=>($_GET['pageSize'])?$_GET['pageSize']:10,
),
));
index.php
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'account-invoiceList',
'dataProvider'=>$repdp,
//'filter'=>$model,
'columns'=>array(
array(
'name'=>'单据编码',
'value'=>'$data["invoiceNO"]',
),
array(
'name'=>'记录日期',
'value'=>'$data["recordDate"]',
),
array(
'name'=>'客户',
'value'=>'Client::client_company_name($data["clientID"],"ECompany")',
),
array(
'name'=>'完成日期',
'value'=>'$data["finishDate"]',
),
array(
'name'=>'付款日期',
'value'=>'$data["paymentDate"]',
),
array(
'name' => '销售凭证',
'value' => 'Voucher::returnVoucherNo(VoucherAccount::getVoucherID($data["invoiceID"],1))',
),
array(
'name'=>'收款凭证',
'value'=>'Voucher::returnVoucherNo1(VoucherAccount::getVoucherID($data["invoiceID"],1))'
),
),
));