account: "2134"
account_owner: ""
address: "ПОЛЯРНА ВУЛ.,Б.18Д"
counter_precision: "['','1','1','1','']"
counter_tariff: "['','7.464','25.10','3.576','']"
flat: "21"
jek: "213"
length: 0
period: "201205"
result: "true"
service_accrued_summ: "['13560','','','','']"
service_debt_summ: "['1710','','','','']"
service_id: "['35b25213-d4a7-dd21-746e-534de0cfb46e','70b2c9a3-2912-2094-4703-efa310951183','4d68a3e3-a954-98fb-ed68-7f24bb333193','b981ff54-947e-8b4c-310d-5f4f9ad62115','a77fac3b-9a21-0917-b266-7f28adf4787e']"
service_organization: "['ЖЕК - 513','ПАТ "АК"КИЇВВОДОКАНАЛ"','ПАТ "КИЇВЕНЕРГО"','ПАТ "АК"КИЇВВОДОКАНАЛ"','ПАТ "КИЇВЕНЕРГО"']"
service_title: "['ЖИТЛОВО-КОМУНАЛЬНІ ТА ІНШІ ПОСЛУГИ','ЦЕНТРАЛІЗОВАНЕ ПОСТАЧАННЯ ХОЛОДНОЇ ВОДИ ТА ВОДОВІДВЕДЕННЯ','ЦЕНТРАЛІЗОВАНЕ ПОСТАЧАННЯ ГАРЯЧОЇ ВОДИ','ЦЕНТРАЛІЗОВАНЕ ВОДОВІДВЕДЕННЯ ГАРЯЧОЇ ВОДИ','ЦЕНТРАЛІЗОВАНЕ ОПАЛЕННЯ']"
type: "verify"
var extra_fee_code=parseFloat(ans.extra_fee_code);
var extra_fee_subcode=parseFloat(ans.extra_fee_subcode);
var extra_fee_payable=parseFloat(ans.extra_fee_payable);
var xfcounter_code=parseFloat(ans.xfcounter_code);
var xfcounter_subcode=parseFloat(ans.xfcounter_subcode);
var xfcounter_payable=parseFloat(ans.xfcounter_payable);
var counter_code=parseFloat(ans.counter_code);
// var counter_code=JSON.parse(ans['counter_code']);
var counter_subcode=parseFloat(ans.counter_subcode);
var counter_tariff=parseFloat(ans.counter_tariff);
var counter_previous_value=parseFloat(ans.counter_previous_value);
var counter_percision=parseFloat(ans.counter_percision);
<?php
if ( ($_REQUEST["type"] == "pay")&&($_REQUEST["data"] != "")){
/*header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="order.nsmep"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . $_REQUEST["data"].length);
ob_clean();
flush();
print $_REQUEST["data"];*/
header('Content-type: application/X-Nsp-Plugin');
header('Content-Disposition: inline; filename="order.nsmep";');
print $_REQUEST["data"];
}
else if (isset($_REQUEST["id"]) && is_numeric($_REQUEST["id"])&&($_REQUEST["id"]!=50)){ ?>
ans: Array[0]
"<br />↵<font size": "'1'><table class"
account: "1232"
account_owner: ""
address: "СВЯТОШИНСЬКА ВУЛ.,Б.4"
counter_precision: "['','0','1','','','']"
counter_tariff: "['','0.3084','7.464','','','']"
flat: "54"
jek: "231"
length: 0
period: "201205"
result: "true"
service_accrued_summ: "['25032','','','','','']"
service_debt_summ: "['-103079','','210','1945','266','']"
service_id: "['35b25213-d4a7-dd21-746e-534de0cfb46e','a156ca58-b91f-9071-fd0c-3cc52c44cd3c','70b2c9a3-2912-2094-4703-efa310951183','4d68a3e3-a954-98fb-ed68-7f24bb333193','b981ff54-947e-8b4c-310d-5f4f9ad62115','a77fac3b-9a21-0917-b266-7f28adf4787e']"
service_organization: "['ФIЛIЯ № 813','ПАТ "КИЇВЕНЕРГО"','ПАТ "АК"КИЇВВОДОКАНАЛ"','ПАТ "КИЇВЕНЕРГО"','ПАТ "АК"КИЇВВОДОКАНАЛ"','ПАТ "КИЇВЕНЕРГО"']"
service_title: "['ЖИТЛОВО-КОМУНАЛЬНІ ТА ІНШІ ПОСЛУГИ','ЕЛЕКТРОЕНЕРГIЯ','ЦЕНТРАЛІЗОВАНЕ ПОСТАЧАННЯ ХОЛОДНОЇ ВОДИ ТА ВОДОВІДВЕДЕННЯ','ЦЕНТРАЛІЗОВАНЕ ПОСТАЧАННЯ ГАРЯЧОЇ ВОДИ','ЦЕНТРАЛІЗОВАНЕ ВОДОВІДВЕДЕННЯ ГАРЯЧОЇ ВОДИ','ЦЕНТРАЛІЗОВАНЕ ОПАЛЕННЯ']"
type: "verify"
function parse_answer(data){
try {window.notebook.hideProgress();}
catch(e) {}
if (data.indexOf('ERROR:') == 0) {
document.getElementById("btn_next").disabled = false;
try {window.notebook.alert(data.replace("ERROR:",""));}
catch(e) {alert(data.replace("ERROR:",""));}
} else {
var ans=parse_str(data); -------- вот этот анс
//ans['debt'] = 1929;
var extra_fee_code=parseFloat(ans.extra_fee_code);
var extra_fee_subcode=parseFloat(ans.extra_fee_subcode);
var extra_fee_payable=parseFloat(ans.extra_fee_payable);
var xfcounter_code=parseFloat(ans.xfcounter_code);
var xfcounter_subcode=parseFloat(ans.xfcounter_subcode);
var xfcounter_payable=parseFloat(ans.xfcounter_payable);
var counter_code=parseFloat(ans.counter_code);
// var counter_code=JSON.parse(ans['counter_code']);
var counter_subcode=parseFloat(ans.counter_subcode);
var counter_tariff=parseFloat(ans.counter_tariff);
var counter_previous_value=parseFloat(ans.counter_previous_value);
var counter_percision=parseFloat(ans.counter_percision);
var AccountInfo = ans.address+", кв. "+ans.flat + "<?=lang(' ЖЕО ',' ЖЕО ')?>" + ans.jek + "<?=lang(' О/рахунок ',' О/рахунок ')?>" ;
document.verify.jek.value = ans.jek;
document.verify.account.value = ans.account;
document.pay.period.value = ans.period;
document.getElementById("account_info_ans").innerHTML = AccountInfo;
document.getElementById("account_info_ans2").innerHTML = AccountInfo;
document.pay.summ.value=ans.summ;
document.pay.debt.value=ans.debt;
alert(data);
var extra_fee_list_details_html = "<div class='container left' style='background-color:#F9FFC9;'>" +
"<span>" +
"<span style='width:180px;font-size:18px;' class='text div_middle'>" +
"{TEXT}"+
"</span>" +
"<span style='padding-left:10px;width:70px;text-align:right;' class='text_ans div_middle'>{SUMM}</span><span style='font-size:14px;' class='text_ans div_middle'> грн.</span>" +
"</span>" +
"</div>";
extra_fee_list_details_html = extra_fee_list_details_html.replace("{TEXT}", "<?=lang('ВСЬОГО','ВСЕГО');?>")
.replace("{SUMM}",kop2str(ans.summ));
PereplataHtml = "<div class='container left' style='background-color:#F9FFC9;'>" +
"<span>" +
"<span style='width:180px;font-size:18px;' class='text div_middle'>" +
"Переплата" +
"</span>" +
"<span style='padding-left:10px;width:70px;text-align:right;' class='text_ans div_middle'>{XX}</span><span style='font-size:14px;' class='text_ans div_middle'> грн.</span>" +
"</span>" +
"</div>";
if (ans.debt<0){
extra_fee_list_details_html += PereplataHtml.replace("{XX}",kop2str(ans.debt));
}
DebtHtml = "<div class='container left' style='background-color:#F9FFC9;'>" +
"<span>" +
"<span style='width:180px;font-size:18px;' class='text div_middle'>" +
"<?=lang('Борг','Долг');?>" +
"</span>" +
"<span style='padding-left:10px;width:70px;text-align:right;' class='text_ans div_middle'>{XX}</span><span style='font-size:14px;' class='text_ans div_middle'> грн.</span>" +
"</span>" +
"</div>";
if (ans.debt>0){
extra_fee_list_details_html += DebtHtml.replace("{XX}",kop2str(ans.debt));
}
AddAmountHtml = "<div class='container left padding_input' style='background-color:#F9FFC9;'>" +
"<div class='field_text' style='color:#000000;' align='left'><?=lang('Додаткова сплата, або сплата боргу','Дополнительная оплата, или оплата долга')?>:</div>" +
"<input type='tel' class='input_box' id='add_amount' name='add_amount' value='0,00' onInput='recalc_sum()' onPropertyChange='recalc_sum()' maxlength='12'>" +
"</div>";
extra_fee_list_details_html += AddAmountHtml;
// alert(ans['summ']);
// alert(ans['debt']);
ToPaidIncludeOverPaymentInfoHtml = "<div class='container left' style='background-color:#F9FFC9;'>" +
"<span>" +
"<span style='width:180px;font-size:18px;' class='text div_middle'>" +
"<?=lang('До сплати','К оплате')?>" +
"</span>" +
"<span id='ToPaidIncludeOverPaymentInfo' style='padding-left:10px;width:70px;text-align:right;' class='text_ans div_middle'>{XX}</span><span style='font-size:14px;' class='text_ans div_middle'> грн.</span>" +
"</span>" +
"</div>";
var ToPaidIncludeOverPaymentInfo;
if (ans.debt<0){
ToPaidIncludeOverPaymentInfo = parseFloat(ans.summ) + parseFloat(ans.debt);
}
else{
ToPaidIncludeOverPaymentInfo = parseFloat(ans.summ);
}
///////////////////////////////////////////////////////////////////////////////////////
//------------------alert(ToPaidIncludeOverPaymentInfo); ------ undefined;
if (counter_code.length!=0)
{
extra_fee_list_details_html += ToPaidIncludeOverPaymentInfoHtml.replace("{XX}",kop2str(ToPaidIncludeOverPaymentInfo));
}
//////////////////////////////////////////////
AllToPaidHtml = "<div class='container left padding_input' style='background-color:#F9FFC9;'>" +
"<div class='field_text' style='color:#000000;' align='left'><?=lang('ВСЬОГО ДО СПЛАТИ','ВСЕГО К ОПЛАТЕ')?>" + " (" + "<?=kops2str($pricemin)?>" + " - " + "<?=kops2str($pricemax)?>" + " грн):</div>" +
"<input type='tel' class='input_box' id='amount{I}' name='amount{I}' value='{XX}' maxlength='12'>" +
"</div>";
if (counter_code.length==0)
{
extra_fee_list_details_html += AllToPaidHtml.replace("{XX}",kop2str(ToPaidIncludeOverPaymentInfo))
.replace("{I}","1");
}
ExtraFee = "<div class='container left'>" +
"<span>" +
"<span style='width:180px;font-size:18px;' class='text div_middle'>" +
"{ExtraFeeName}" +
"</span>" +
"<span style='padding-left:10px;width:70px;text-align:right;' class='text_ans div_middle'>{Payable}</span><span style='font-size:14px;' class='text_ans div_middle'> грн.</span>" +
"</span>" +
"</div>";
//------------------------------------------------------------------------------------
var extra_fee_list_html="";
for (var i=0;i<extra_fee_code.length;i++){
extra_fee_list_html+=ExtraFee.replace("{ExtraFeeName}",GetPaymentName(extra_fee_code[i],extra_fee_subcode[i]))
.replace("{Payable}",kop2str(extra_fee_payable[i]));
}
var xf_counter_list_html="";
for (var i=0;i<xfcounter_code.length;i++){
xf_counter_list_html+=ExtraFee.replace("{ExtraFeeName}",GetPaymentName(xfcounter_code[i],xfcounter_subcode[i]))
.replace("{Payable}",kop2str(xfcounter_payable[i]));
}
SaveTemplateHtml = "<div class='input_container left' style='display:none;' id='template{I}'>" +
"<div class='div_middle' style='width:50px;padding-left:10px;'>" +
"<input type='checkbox' class='check' id='save_template{I}' />" +
"</div>" +
"<div class='text_template div_middle' id='text_template'>" +
"<?=lang('Зберегти шаблон','Сохранить шаблон')?>" +
"</div>" +
"</div>";
if (counter_code.length==0)
{
extra_fee_list_details_html += SaveTemplateHtml.replace(/{I}/g,"1");
}
document.getElementById("extra_fee_list").innerHTML= extra_fee_list_html + xf_counter_list_html + extra_fee_list_details_html;
CounterList = "<div style='border-bottom: 1px solid #83abc6;background-color:#e1e1e1;font-size:15px;color:#4f4f4f;padding-left:10px;padding-top:8px;padding-bottom:8px;font-family: Arial;font-weight:bold;'>" +
"<span style='width:180px;' class='div_middle'>" +
"{CounterName}:" +
"</span>" +
"<span style='padding-left:10px;' class='div_middle'>Тариф {Tariff}</span>" +
"</div>" +
"<div class='container left'>" +
"<table cellpadding=0 cellspacing=0 width='90%' align='center'>" +
"<tr>" +
"<td class='field_text' width='25%' align='center'><?=lang('Поточні','Текущие')?></td>" +
"<td class='field_text' width='25%' align='center'><?=lang('Попередні','Предыдущие')?></td>" +
"<td class='field_text' width='25%' align='center'><?=lang('Різниця','Разница')?></td>" +
"</tr>" +
"<tr>" +
"<td align='center' width='25%'><input type='tel' id='counter{I}_current' class='input_box' style='width:70%' value='' maxlength='7' onInput='recalc_counters_amount({I})' onPropertyChange='recalc_counters_amount({I})' ></td>" +
"<td align='center' width='25%'><input type='tel' id='counter{I}_previous' class='input_box' style='width:70%' value='{PreviousValue}' maxlength='7' onInput='recalc_counters_amount({I})' onPropertyChange='recalc_counters_amount({I})' ></td>" +
"<td align='center' width='25%'><input type='tel' id='counter{I}_used' lign='right' class='input_box' style='width:70%;background-color:#f6f6f6;' value='' readonly maxlength='7'></td>" +
"</tr>" +
"<tr>" +
"<td colspan=3 align='center' style='padding-top:10px;'>" +
"<div class='field_text' style='color:#000000;' align='left'><?=lang('До сплати','К оплате')?>:</div>" +
"<input id='counter{I}_ammount' type='tel' class='input_box' value='' onInput='recalc_sum()' onPropertyChange='recalc_sum()' maxlength='7'>" +
"</td>" +
"</tr>" +
"</table>" +
"<input type='hidden' id='counter{I}_code' value='{Code}' />"+
"<input type='hidden' id='counter{I}_tariff' value='{Tariff}' />"+
"<input type='hidden' id='counter{I}_percision' value='{Percision}' />"+
"</div>";
var counter_list_html="";
document.pay.counter_number.value=counter_code.length;
for (var i=0;i<counter_code.length;i++){
counter_list_html+=CounterList.replace("{CounterName}",GetPaymentName(counter_code[i],counter_subcode[i],false))
.replace(/{Tariff}/g,counter_tariff[i])
.replace("{PreviousValue}",counter_previous_value[i])
.replace(/{I}/g,i)
.replace("{Code}",counter_code[i])
.replace("{Percision}",counter_percision[i]);
}
if (counter_code.length!=0)
{
document.getElementById("counter_list").innerHTML = counter_list_html +
AllToPaidHtml.replace("{XX}",kop2str(ToPaidIncludeOverPaymentInfo)).replace("{I}","2") +
SaveTemplateHtml.replace(/{I}/g,"2");
}
if (counter_code.length==0)
{
document.getElementById("btn_next2").style.display="none";
document.getElementById("btn_pay1").style.display="inline";
}
else{
document.getElementById("btn_next2").style.display="inline";
document.getElementById("btn_pay1").style.display="none";
}
if (ans.paid_amount>0){
show('paid_history');
document.getElementById("paid_history_info").innerHTML = ans.paid_date + " " + kop2str(ans.paid_amount) + " грн.";
}
else{
hide('paid_history');
}
try {
if (window.notebook !== undefined || enableTemplateForWindowsApp === true) {
setClientIcon();
}
} catch(e) { }
recalc_sum();
hide('verify_block');
show('pay1_block');
updateWindowsAppState();
}
}
-------- JavaScript
-----PHP------
function parse_str(str, array){
var glue1 = '=';
var glue2 = '&';
var array2 = str.split(glue2);
var array3 = [];
for(var x=0; x<array2.length; x++){
var tmp = array2[x].split(glue1);
array3[unescape(tmp[0])] = unescape(tmp[1]).replace(/[+]/g, ' ');
}
if(array){
array = array3;
} else{
return array3;
}
}
if ('undefined' == typeof String.prototype.crop) {
String.prototype.crop = function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
}
}