init
This commit is contained in:
42
modules/EcmInvoiceOutOlds/getEDIXml.php
Normal file
42
modules/EcmInvoiceOutOlds/getEDIXml.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
include_once("modules/EcmInvoiceOutOlds/createXML.php");
|
||||
//echo createCorrectInvoiceXml('887312d1-c5a3-7405-cb13-529c845fe5a5');
|
||||
//return;
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$document_no = array();
|
||||
|
||||
|
||||
$type = 'correct';
|
||||
|
||||
$res = $db->query("SELECT id, parent_name, document_no, date_entered FROM ecminvoiceoutolds where type='$type' and parent_name like 'Real%' and register_date>='2014-01-01' and document_no NOT IN (SELECT nr_faktury FROM nr_faktury) AND canceled='0' ORDER BY register_date");
|
||||
//$res = $db->query("SELECT id, parent_name, document_no, date_entered FROM ecminvoiceoutolds where type='correct' and parent_name like 'Real%' and document_no in ('FVKOR 853/14')");
|
||||
|
||||
|
||||
|
||||
$i =0;
|
||||
echo $res->num_rows.'<br>';
|
||||
//die();
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
echo $row['parent_name'].' '.$row['document_no'].' '.$row['date_entered'].'<br>';
|
||||
$i++;
|
||||
$inv = new EcmInvoiceOutOld();
|
||||
$inv->retrieve($row['id']);
|
||||
if ($type == 'normal')
|
||||
$xml=createInvoiceXml($inv->id);
|
||||
if ($type == 'correct')
|
||||
$xml=createCorrectInvoiceXml($inv->id);
|
||||
//die();
|
||||
//continue;
|
||||
$file="/home/mz/edi/infinite-salesorders/invoice/".str_replace(" ","",str_replace("/","",$inv->document_no)).".xml";
|
||||
fopen($file);
|
||||
file_put_contents($file,$xml);
|
||||
chmod($file,0777);
|
||||
unset($inv);
|
||||
}
|
||||
echo '<br>'.$i.'<br>';
|
||||
return;
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user