some fixes
This commit is contained in:
@@ -69,6 +69,7 @@ function getInvoices($source, $date, $type)
|
||||
$query .= " AND i.type='$type'";
|
||||
}
|
||||
$query .= " ORDER BY i.register_date";
|
||||
|
||||
$result = $db->query($query);
|
||||
$invoices = array();
|
||||
while ($row = $db->fetchByAssoc($result)) {
|
||||
@@ -129,6 +130,20 @@ function exportToRewizor($source, $date, $type)
|
||||
$i['corrected_document_no'] = $fv['document_no'];
|
||||
$i['corrected_register_date'] = date("Ymd000000",strtotime(date('d.m.Y', strtotime($fv['register_date']))));
|
||||
}
|
||||
$i['vats'] = array();
|
||||
foreach ($i['products'] as $p) {
|
||||
if (!isset($i['vats'][$p['vat_value']])) {
|
||||
$i['vats'][$p['vat_value']] = array(
|
||||
'netto' => 0,
|
||||
'brutto' => 0,
|
||||
'vat' => 0,
|
||||
);
|
||||
}
|
||||
$i['vats'][$p['vat_value']]['netto'] += $p['price_netto'] * $p['quantity'];
|
||||
$i['vats'][$p['vat_value']]['brutto'] += $p['price_brutto'] * $p['quantity'];
|
||||
$i['vats'][$p['vat_value']]['vat'] += ($p['price_brutto'] - $p['price_netto']) * $p['quantity'];
|
||||
$i['vats'][$p['vat_value']]['vat_value'] = $p['vat_value'];
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("data", $invoices);
|
||||
|
||||
Reference in New Issue
Block a user