1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: 37: 38: 39: 40:
41: protected $_saveParametersInSession = true;
42:
43: 44: 45: 46:
47: public function __construct()
48: {
49: parent::__construct();
50: $this->setId('settlementGrid');
51: $this->setUseAjax(true);
52: }
53:
54: 55: 56: 57:
58: protected function _prepareCollection()
59: {
60: $collection = Mage::getResourceModel('paypal/report_settlement_row_collection');
61: $this->setCollection($collection);
62: if (!$this->getParam($this->getVarNameSort())) {
63: $collection->setOrder('row_id', 'desc');
64: }
65: return parent::_prepareCollection();
66: }
67:
68: 69: 70: 71:
72: protected function _prepareColumns()
73: {
74: $settlement = Mage::getSingleton('paypal/report_settlement');
75: $this->addColumn('report_date', array(
76: 'header' => $settlement->getFieldLabel('report_date'),
77: 'index' => 'report_date',
78: 'type' => 'date'
79: ));
80: $this->addColumn('account_id', array(
81: 'header' => $settlement->getFieldLabel('account_id'),
82: 'index' => 'account_id'
83: ));
84: $this->addColumn('transaction_id', array(
85: 'header' => $settlement->getFieldLabel('transaction_id'),
86: 'index' => 'transaction_id'
87: ));
88: $this->addColumn('invoice_id', array(
89: 'header' => $settlement->getFieldLabel('invoice_id'),
90: 'index' => 'invoice_id'
91: ));
92: $this->addColumn('paypal_reference_id', array(
93: 'header' => $settlement->getFieldLabel('paypal_reference_id'),
94: 'index' => 'paypal_reference_id'
95: ));
96: $this->addColumn('transaction_event_code', array(
97: 'header' => $settlement->getFieldLabel('transaction_event'),
98: 'index' => 'transaction_event_code',
99: 'type' => 'options',
100: 'options' => Mage::getModel('paypal/report_settlement_row')->getTransactionEvents()
101: ));
102: $this->addColumn('transaction_initiation_date', array(
103: 'header' => $settlement->getFieldLabel('transaction_initiation_date'),
104: 'index' => 'transaction_initiation_date',
105: 'type' => 'datetime'
106: ));
107: $this->addColumn('transaction_completion_date', array(
108: 'header' => $settlement->getFieldLabel('transaction_completion_date'),
109: 'index' => 'transaction_completion_date',
110: 'type' => 'datetime'
111: ));
112: $this->addColumn('gross_transaction_amount', array(
113: 'header' => $settlement->getFieldLabel('gross_transaction_amount'),
114: 'index' => 'gross_transaction_amount',
115: 'type' => 'currency',
116: 'currency' => 'gross_transaction_currency',
117: ));
118: $this->addColumn('fee_amount', array(
119: 'header' => $settlement->getFieldLabel('fee_amount'),
120: 'index' => 'fee_amount',
121: 'type' => 'currency',
122: 'currency' => 'gross_transaction_currency',
123: ));
124: return parent::_prepareColumns();
125: }
126:
127: 128: 129: 130:
131: public function getGridUrl()
132: {
133: return $this->getUrl('*/*/grid');
134: }
135:
136: 137: 138: 139:
140: public function getRowUrl($item)
141: {
142: return $this->getUrl('*/*/details', array('id' => $item->getId()));
143: }
144: }
145: