29 lines
547 B
PHP
29 lines
547 B
PHP
<?php
|
|
//Skrypt poprawia korekty kwartalne dla MSHP
|
|
|
|
$db = $GLOBALS['db'];
|
|
|
|
$query;
|
|
|
|
//---------------------------------------
|
|
$query = "
|
|
select i.document_no, i.id, i.total_netto from ecminvoiceouts as i
|
|
inner join accounts as a
|
|
on a.id = i.parent_id
|
|
where
|
|
i.register_date like '2014-10%'
|
|
and a.parent_id = '1249'
|
|
and i.purchase_price = 0
|
|
and i.paid_val IS NULL
|
|
order by i.date_entered desc;
|
|
";
|
|
|
|
$inv = $db->query($query);
|
|
$sum = 0;
|
|
|
|
while ($i = $db->fetchByAssoc($inv)) {
|
|
$sum+=$i['total_netto'];
|
|
}
|
|
|
|
echo $sum;
|
|
?>
|