Article View: pl.comp.lang.delphi
Article #346060Re: Delphi XE Vat czynny
From: konsul41
Date: Fri, 15 Sep 2017 09:37
Date: Fri, 15 Sep 2017 09:37
126 lines
5644 bytes
5644 bytes
Adres to 'https://ppuslugi.mf.gov.pl/'
i mój skrypt po drobnych zmianach
"Zachowane prawa własności intelektualnej"
/**
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written
permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
"use strict";
/**
* https://github.com/ariya/phantomjs/blob/master/examples/waitfor.js
*/
function waitFor(testFunction, readyFunction, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 10000,
start = new Date().getTime(),
condition = false,
interval = setInterval(function() {
if ( (new Date().getTime() - start < maxtimeOutMillis) &&
!condition ) {
condition = (typeof(testFunction) === "string" ?
eval(testFunction) : testFunction());
} else {
if(!condition) {
phantom.exit(1);
} else {
typeof(readyFunction) === "string" ?
eval(readyFunction) : readyFunction();
clearInterval(interval);
}
}
}, 250);
};
var system = require('system'),
args = system.args,
nip,
nieJest = "Podmiot o podanym identyfikatorze podatkowym NIP nie
jest zarejestrowany jako podatnik VAT",
page = require('webpage').create();
if (1 === args.length) {
console.log('NIP is required');
phantom.exit(1);
} else {
nip = args[1];
}
page.open('https://ppuslugi.mf.gov.pl/', function(status) {
if (status !== "success") {
console.log("Unable to access network");
phantom.exit();
} else {
waitFor(function(){
return page.evaluate(function() { return
$('#SidebarActions_WebUMn li').length > 0; });
}, function(){
page.evaluate(function() {
FWDC.executeAction(1005, null, 'FLOW');
});
waitFor(function(){
return page.evaluate(function() { return
$('#b-7').length > 0; });
}, function(){
page.evaluate(function(nip) {
$('#b-7').val(nip);
$('#b-8').trigger('click');
}, nip);
waitFor(function(){
return page.evaluate(function() { return
$('#container_b-3').is(':visible'); });
}, function() {
/*console.log('odpowiedz');
console.log(' ');
console.log(' ');*/
var msg = page.evaluate(function() { return
$.trim($('#container_b-3').text()); }),
date = page.evaluate(function() { return
$.trim($('#caption2_b-b').text().split(':')[1]).split('-').reverse().join('-');
}),
response = {
"nip": nip,
"msg": msg,
"date": date,
"status": msg == true ? false : true
};
console.log(JSON.stringify(response.nip));
console.log(JSON.stringify(response.status));
phantom.exit();
});
});
});
}
});
Technical Details
Message-ID:
<opg700$auv$1@portraits.wsisiz.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!wsisiz.edu.pl!.POSTED.jue163.internetdsl.tpnet.pl!not-for-mailReferences:
<opdgg8$sdc$1@portraits.wsisiz.edu.pl> <lwrsmb7wim9z.dlg@tyczka.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!wsisiz.edu.pl!.POSTED.jue163.internetdsl.tpnet.pl!not-for-mail From: "konsul41@wp.pl" <konsul41@wp.pl> Newsgroups: pl.comp.lang.delphi Subject: Re: Delphi XE Vat czynny Date: Fri, 15 Sep 2017 11:37:06 +0200 Organization: http://www.wit.edu.pl Message-ID: <opg700$auv$1@portraits.wsisiz.edu.pl> References: <opdgg8$sdc$1@portraits.wsisiz.edu.pl> <lwrsmb7wim9z.dlg@tyczka.com> Mime-Version: 1.0 Injection-Date: Fri, 15 Sep 2017 09:37:05 -0000 (UTC) Injection-Info: portraits.wsisiz.edu.pl; posting-host="jue163.internetdsl.tpnet.pl:95.48.160.163"; logging-data="11231"; mail-complaints-to="abuse@wsisiz.edu.pl" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 In-Reply-To: <lwrsmb7wim9z.dlg@tyczka.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit