if (count($invoice_sh) == 0) { $content .= '<strong class="red">No status history found</strong>'; } else { $stahis = array(); $sh = array(); $sh['sort'] = 'No'; $sh['date_add'] = 'Status Date'; $sh['source'] = 'Status'; $stahis[] = $sh; $shcount = 0; foreach ($invoice_sh as $ish) { $shcount++; $sh = array(); $sh['sort'] = $shcount; $sh['date_add'] = date('d.m.Y H:i:s', strtotime($ish['status_date'])); $sh['source'] = payone_invoice_status($ish['status']); $stahis[] = $sh; } $content .= tep_draw_table('', $stahis); } $content .= '<div> </div>'; $content .= '<h3>Payment History</h3>'; if (count($invoice->receipts) == 0) { $content .= '<strong class="red">No transaction history found</strong>'; } else { $receipts = array(); $r = array(); $r['sort'] = 'No'; //$r['date_add'] = 'Transaction Date'; $r['date_add'] = 'Payone Submit Date'; $r['source'] = 'Payment Amount';
function retrieveDetail($id) { $l = $this->retrieveDetailData($id); $request = unserialize($l['log_process_data_submit']); $response = strlen($l['log_process_data_result']) <= 4 ? $l['log_process_data_result'] : unserialize($l['log_process_data_result']); $txid = isset($request['txid']) && $request['txid'] != '' ? 'TXID ' . $request['txid'] : '<span class="notice">No TXID</span>'; $log_time = date('d.m.y H:i:s', strtotime($l['log_process_time'])); $log_process = '<span class="' . ($l['log_process'] == 'S' ? 'green">Submit' : 'blue">Receive') . '</span>'; $mode = '<span class="' . (strtolower($request['mode']) == 'live' ? 'bold' : '') . '">' . $request['mode'] . '</span>'; $status = $response == "TSOK" || $response['status'] == "TSOK" || $response['status'] == 'APPROVED' || $response['status'] == 'REDIRECT' ? '<span class="green">OK</span>' : '<span class="green">ERROR</span>'; $result = '<h3 class="box ui-corner-all" style="margin-bottom:20px;">' . $txid . ' ⋅ ' . $log_time . ' ⋅ ' . $log_process . ' ⋅ ' . $l['log_process_method'] . ' ⋅ ' . $mode . ' ⋅ ' . $status . '</h3>'; $logdata = '<div style="float:left;width:400px;border-right:4px solid #efefef;">'; $logdata .= '<h3>Request</h3>'; if (is_array($request)) { $logdata .= '<div><table border="0" cellpadding="0" cellspacing="0">'; foreach ($request as $param => $value) { if ($param == 'txid' || $param == 'invoiceid') { global $server; use_class('payone_invoice'); if ($param == 'txid') { $payi = new payone_invoice('payone_txid', $value); } elseif ($param == 'invoiceid') { $payi = new payone_invoice('invoice_no', $value); } $link_order = "{$server}/?open=customer-care-order-detail&source=" . ($payi->detail['invoice_order_type'] == 'S' ? 'SP' : 'JG') . '&id=' . $payi->detail['invoice_order_id']; $link_order = 'Click <a target="_blank" href="http://' . $link_order . '">here</a> to open Order Detail'; } if (is_array($value)) { foreach ($value as $vkey => $vval) { $logdata .= '<tr><td>' . $param . '[' . $vkey . ']</td><td>' . $vval . '</td></tr>'; } } else { $logdata .= '<tr><td>' . $param . '</td><td>' . $value . '</td></tr>'; } } $logdata .= '</table></div>'; } else { $logdata .= $request == '' ? '<em>BLANK</em>' : $request; } $logdata .= '</div>'; $logdata .= '<div style="margin-left:420px;">'; $logdata .= '<h3>Response</h3>'; if (is_array($response)) { $logdata .= '<div><table border="0" cellpadding="0" cellspacing="0">'; foreach ($response as $param => $value) { if (is_array($value)) { foreach ($value as $vkey => $vval) { $logdata .= '<tr><td>' . $param . '[' . $vkey . ']</td><td>' . $vval . '</td></tr>'; } } else { $logdata .= '<tr><td>' . $param . '</td><td>' . $value . '</td></tr>'; } } $logdata .= '</table></div>'; } else { $logdata .= $response == '' ? '<em>BLANK</em>' : $response; } $logdata .= '</div>'; if ($link_order != '') { $logdata = '<h3>' . $link_order . "</h3>" . $logdata; } $result .= $logdata; //Check unsent refund $payone_log_group = array('1', '39'); global $session_userinfo; if (isset($payi->detail['invoice_id']) && $payi->detail['invoice_id'] != '' && in_array($session_userinfo['group'], $payone_log_group)) { $invoice_id = $payi->detail['invoice_id']; $result .= '<div style="clear:both;"></div><br/><br/>'; $result .= '<div class="sop-box"><h3 class="red">Please more carefull to update below data, make sure all updates are correct based on problem analysis!<br/></h3> <br/><span>Please use also this <a target="_blank" href="https://docs.google.com/spreadsheet/ccc?key=0ArXESovGbTYcdF9RZ19xaUxFV2E2UjFNY2hzQzRsUVE&usp=drive_web#gid=0">Payone Error Guidance</a> for helping solving problems</span> </div><br/>'; $result .= '<div class="float-left w400">'; $result .= '<h3>Invoice Data</h3>'; $result .= '<input type="hidden" id="invoice-id" value="' . $payi->detail['invoice_id'] . '"/>'; $result .= '<table>'; $result .= '<tr><td>Invoice Date</td><td>' . date('d-m-Y', strtotime($payi->detail['invoice_date'])) . '</td></tr>'; $result .= '<tr><td>txid</td><td>' . payoneWebLink($payi->detail['payone_txid']) . '</td></tr>'; $input_title = 'title="press enter to update this value"'; $pi_input_text = array('Invoice Amount' => 'invoice_amount', 'Amount Paid' => 'invoice_amount_paid', 'Amount Cancelled' => 'invoice_amount_canceled', 'Amount Fines' => 'invoice_amount_fines', 'Amount Fines Cancelled' => 'invoice_amount_fines_canceled', 'Amount Refund' => 'invoice_amount_overpayment', 'Amount Refund Cancelled' => 'invoice_amount_overpayment_canceled', 'Payone Saldo' => 'payone_saldo', 'Sequence Number' => 'sequencenumber'); foreach ($pi_input_text as $k => $v) { $result .= '<tr><td>' . $k . '</td><td><input name="' . $v . '" type="text" ' . $input_title . ' value="' . $payi->detail[$v] . '"/></td></tr>'; } $status_desc = "<h3>Invoice Status</h3>"; foreach (payone_invoice_status() as $ps => $pd) { $status_desc .= "{$ps}: {$pd}<br/>"; } $result .= '<tr><td>Status<span class="ui-icon ui-icon-info help" style="float:right;" title="' . $status_desc . '"></span></td><td><input name="invoice_complete_status" type="text" ' . $input_title . ' value="' . $payi->detail['invoice_complete_status'] . '"/></td></tr>'; $result .= '</table></div>'; $dbq = tep_db_query("SELECT * FROM payone_orders_return WHERE invoice_id = {$invoice_id} AND status = 0"); if (tep_db_num_rows($dbq) > 0) { $table = array(); $t = array(); $t['d'] = 'Created'; $t['e'] = 'id'; $t['sp'] = 'pr'; $t['q'] = 'no'; $t['id1'] = 'de'; $t['s'] = 'va'; $t['id2'] = 'Action'; $table[] = $t; $btn_12 = '<input class="cancel" type="button" value="C12" title="Cancel this return value"/>'; $btn_13 = '<input class="cancel" type="button" value="C13" title="Stop sending this return to payone becuase we have processed/will process it manually"/>'; while ($r = tep_db_fetch_array($dbq)) { $input_hid = '<input id="' . $r['pkey_id'] . '" type="hidden" value="' . $r['pkey_id'] . '"/>'; $t['d'] = date('d-m-Y H:i:s', strtotime($r['created_date'])); $t['e'] = $r['id']; $t['sp'] = displayCurrency($r['currency'], $r['pr'] / 100); $t['q'] = $r['no']; $t['id1'] = $r['de']; $t['s'] = $r['va']; $t['id2'] = $input_hid . $btn_12 . $btn_13; $table[] = $t; } $result .= '<div>'; $result .= '<h3>Queued Refund</h3>'; $result .= tep_draw_table('spo', $table); $result .= '</div>'; } } return $result; }
} $total_order_qty += $row['order_quantity']; $oid = '<input type="hidden" id="oid-' . $row['order_id'] . '" name="oid" value="' . $row['order_id'] . '" />'; $otype = '<input type="hidden" name="otype" value="' . $row['type'] . '" />'; $allow_prioritizing = $row['type'] == 'SP' && !is_null($row['order_date']) && ($row['status'] <= 2 || $row['status'] == 3 && $row['print_confirmed'] == 0); $priority_checked = $row['priority'] == '1' ? ' checked="checked"' : ''; $c = array(); $c['act'] = '<input type="checkbox" name="priority" title="' . $sop_mouse_over['priority_checkbox'] . '"' . ($allow_prioritizing ? '' : ' disabled="disabled"') . $priority_checked . ' />' . $otype . $oid; $c['c'] = ucwords($row['customer_name']); $c['sp'] = $row['spcode']; $c['date'] = is_null($row['order_date']) ? '<span class="notice">No Orders</span>' : date('d.m.Y', strtotime($row['order_date'])); //$c['d'] = $row['id']; $c['id3'] = $row['city']; $c['d2'] = $row['zipcode']; $c['id1'] = is_null($row['status']) ? '<span class="notice">-</span>' : $statusName[$row['status']]; $c['id2'] = is_null($row['invoice_id']) ? '<span class="notice">No Invoice</span>' : payone_invoice_status($row['invoice_status']); $found[] = $c; } $total_cust = count($customers); $result .= '<div class="bold">Total Customers: ' . $total_cust . ' • Total Orders: ' . $total_found . ' • Total Products: ' . $total_order_qty . '</div>'; $result .= tep_draw_table('spo', $found); } echo utf8_encode($result); exit; } elseif ($_POST['me_action'] == 'UPDATEORDERPRIORITY') { $orders_type = tep_db_prepare_input($_POST['orders_type']); $orders_id = tep_db_prepare_input($_POST['orders_id']); $priority = tep_db_prepare_input($_POST['priority']); $status = false; //false=failed and disabled checkbox, true=success $items = null;