public function action_index() { // Set the name of the template to use $this->xslt_stylesheet = 'payslip'; if (!isset($_GET['employee_id']) || !isset($_GET['period']) || !preg_match('/^\\d{4}-\\d{1,2}$/', $_GET['period'])) { throw new Kohana_exception('Invalid parameters'); } $employee = new Employee($_GET['employee_id']); xml::to_XML($employee->get(), $this->xml_content->appendChild($this->dom->createElement('employee')), NULL, 'id'); $where = ' employee_id = ' . intval($_GET['employee_id']) . ' AND ( description = \'Social fees period ' . $_GET['period'] . '\' OR description = \'Income taxes period ' . $_GET['period'] . '\' OR ( description = \'Salary payout\' AND MONTH(transfer_date) = ' . substr($_GET['period'], 5) . ' AND YEAR(transfer_date) = ' . substr($_GET['period'], 0, 4) . ' ) )'; xml::to_XML(Transactions::get(NULL, 'accounting_date', $where), $this->xml_content->appendChild($this->dom->createElement('transactions')), 'transaction', 'id'); }
* GET method * ====================================== */ case 'get': //Get by Id if (!empty($_GET['id'])) { if ($_GET['id'] == 'types') { echo json_encode($transactions->getTypes()); } //Get ALL } else { isset($_GET['count']) ? $count = intval($_GET['count']) : ($count = 10); isset($_GET['from']) ? $from = $_GET['from'] : ($from = ""); isset($_GET['to']) ? $to = $_GET['to'] : ($to = ""); isset($_GET['account']) ? $account = $_GET['account'] : ($account = ""); echo json_encode($transactions->get($count, $from, $to, $account)); } break; /* * ====================================== * PUT method * ====================================== */ /* * ====================================== * PUT method * ====================================== */ case 'put': //Request $_PUT = $request->getRequestVars();
public function action_index() { $accounting_node = $this->xml_content->appendChild($this->dom->createElement('accounting')); xml::to_XML(Transactions::get(NULL, 'IF(transfer_date = 0,1,0),transfer_date;'), $accounting_node, 'entry', 'id'); }
public function action_payouts() { xml::to_XML(Transactions::get(array('description' => 'Salary payout')), $this->xml_content->appendChild($this->dom->createElement('payouts')), 'payout', 'id'); }
isset($_DATA['to']) ? $to = $_DATA['to'] : ($to = ""); isset($_DATA['account']) ? $account = $_DATA['account'] : ($account = ""); isset($_DATA['tag']) ? $tag = $_DATA['tag'] : ($tag = ""); isset($_DATA['orderby']) ? $orderby = $_DATA['orderby'] : ($orderby = 'id'); isset($_DATA['order']) ? $order = $_DATA['order'] : ($order = 'asc'); echo json_encode($transactions->getByTag($count, $from, $to, $account, $tag, $orderby, $order)); exit; //Get ALL } else { isset($_DATA['count']) ? $count = intval($_DATA['count']) : ($count = 10); isset($_DATA['from']) ? $from = $_DATA['from'] : ($from = ""); isset($_DATA['to']) ? $to = $_DATA['to'] : ($to = ""); isset($_DATA['account']) ? $account = $_DATA['account'] : ($account = ""); isset($_DATA['orderby']) ? $orderby = $_DATA['orderby'] : ($orderby = 'id'); isset($_DATA['order']) ? $order = $_DATA['order'] : ($order = 'asc'); echo json_encode($transactions->get($count, $from, $to, $account, "", $orderby, $order)); exit; } break; /* * ====================================== * PUT method * ====================================== */ /* * ====================================== * PUT method * ====================================== */ case 'put': //Request
function user_has_purchased($item_name) { $message = array_pop(ResponseMails::get_mails_for_event('purchase-finished-' . strtolower($_REQUEST['payment_status']))); $trans = unserialize(Transactions::get($_REQUEST['txn_id'])->post_content); $userdata = get_transient('new-user-' . $_REQUEST['txn_id']); if ($userdata) { $data = array('{txn_id}' => $_REQUEST['txn_id'], '{username}' => $userdata['user_login'], '{password}' => $userdata['user_pass']); } $data['{item}'] = $item_name; $text = $message->post_content; foreach ($data as $key => $value) { $text = str_replace($key, $value, $text); } return $text; }