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_Details_Form extends Mage_Adminhtml_Block_Widget_Form
35: {
36: 37: 38: 39:
40: protected function _prepareForm()
41: {
42: $model = Mage::registry('current_transaction');
43:
44: $settlement = Mage::getSingleton('paypal/report_settlement');
45:
46:
47: $fieldsets = array(
48: 'reference_fieldset' => array(
49: 'fields' => array(
50: 'transaction_id' => array('label' => $settlement->getFieldLabel('transaction_id')),
51: 'invoice_id' => array('label' => $settlement->getFieldLabel('invoice_id')),
52: 'paypal_reference_id' => array('label' => $settlement->getFieldLabel('paypal_reference_id')),
53: 'paypal_reference_id_type' => array(
54: 'label' => $settlement->getFieldLabel('paypal_reference_id_type'),
55: 'value' => $model->getReferenceType($model->getData('paypal_reference_id_type'))
56: ),
57: 'custom_field' => array('label' => $settlement->getFieldLabel('custom_field')),
58: ),
59: 'legend' => Mage::helper('paypal')->__('Reference Information')
60: ),
61:
62: 'transaction_fieldset' => array(
63: 'fields' => array(
64: 'transaction_event_code' => array(
65: 'label' => $settlement->getFieldLabel('transaction_event_code'),
66: 'value' => sprintf('%s (%s)', $model->getData('transaction_event_code'), $model->getTransactionEvent($model->getData('transaction_event_code')))
67: ),
68: 'transaction_initiation_date' => array(
69: 'label' => $settlement->getFieldLabel('transaction_initiation_date'),
70: 'value' => $this->helper('core')->formatDate($model->getData('transaction_initiation_date'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true)
71: ),
72: 'transaction_completion_date' => array(
73: 'label' => $settlement->getFieldLabel('transaction_completion_date'),
74: 'value' => $this->helper('core')->formatDate($model->getData('transaction_completion_date'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true)
75: ),
76: 'transaction_debit_or_credit' => array(
77: 'label' => $settlement->getFieldLabel('transaction_debit_or_credit'),
78: 'value' => $model->getDebitCreditText($model->getData('transaction_debit_or_credit'))
79: ),
80: 'gross_transaction_amount' => array(
81: 'label' => $settlement->getFieldLabel('gross_transaction_amount'),
82: 'value' => Mage::app()->getLocale()
83: ->currency($model->getData('gross_transaction_currency'))
84: ->toCurrency($model->getData('gross_transaction_amount'))
85: ),
86: ),
87: 'legend' => Mage::helper('paypal')->__('Transaction Information')
88: ),
89:
90: 'fee_fieldset' => array(
91: 'fields' => array(
92: 'fee_debit_or_credit' => array(
93: 'label' => $settlement->getFieldLabel('fee_debit_or_credit'),
94: 'value' => $model->getDebitCreditText($model->getData('fee_debit_or_credit'))
95: ),
96: 'fee_amount' => array(
97: 'label' => $settlement->getFieldLabel('fee_amount'),
98: 'value' => Mage::app()->getLocale()
99: ->currency($model->getData('fee_currency'))
100: ->toCurrency($model->getData('fee_amount'))
101: ),
102: ),
103: 'legend' => Mage::helper('paypal')->__('PayPal Fee Information')
104: ),
105: );
106:
107: $form = new Varien_Data_Form();
108: foreach ($fieldsets as $key => $data) {
109: $fieldset = $form->addFieldset($key, array('legend' => $data['legend']));
110: foreach ($data['fields'] as $id => $info) {
111: $fieldset->addField($id, 'label', array(
112: 'name' => $id,
113: 'label' => $info['label'],
114: 'title' => $info['label'],
115: 'value' => isset($info['value']) ? $info['value'] : $model->getData($id),
116: ));
117: }
118: }
119: $this->setForm($form);
120: return parent::_prepareForm();
121: }
122: }
123: