init
This commit is contained in:
36
modules/EcmPurchaseOrders/import.php
Normal file
36
modules/EcmPurchaseOrders/import.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$query2=$db->query("select * from ecmpurchaseorders");
|
||||
$fields2=array();
|
||||
echo $query2->num_rows.'tutaj';
|
||||
|
||||
|
||||
echo "<pre>";
|
||||
while($r = $db->fetchByAssoc($query2)){
|
||||
$vats_summary = '';
|
||||
$total_netto = 0;
|
||||
$total_brutto = 0;
|
||||
$total_vat = 0;
|
||||
|
||||
$res = $GLOBALS ['db']->query ( "select ROUND(sum(total_netto),2) AS total_netto,ROUND(sum((total_netto*ecmvat_value)/100),2) AS total_vat,
|
||||
ROUND(sum(((total_netto*ecmvat_value)/100)+total_netto),2) AS total_brutto,ecmvat_value
|
||||
from ecmpurchaseorderitems where ecmpurchaseorder_id='" . $r['id'] . "' group by ecmvat_id" );
|
||||
while ( $cc = $GLOBALS ['db']->fetchByAssoc ( $res ) ) {
|
||||
$total_netto += $cc ['total_netto'];
|
||||
$total_brutto += $cc ['total_brutto'];
|
||||
$total_vat += $cc ['total_vat'];
|
||||
$vats_summary .= $cc ['ecmvat_value'] . '%:' . $cc ['total_vat'] . ',';
|
||||
}
|
||||
if($total_netto!=0){
|
||||
$res = $GLOBALS ['db']->query ( "update ecmpurchaseorders set vats_summary='" . $vats_summary . "',total_netto='" . $total_netto . "',
|
||||
total_brutto='" . $total_brutto . "' where id='" . $r['id'] . "'" );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user