init
This commit is contained in:
28
modules/EcmPaymentStates/addto.php
Normal file
28
modules/EcmPaymentStates/addto.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
function getTotal($id){
|
||||
$w=$GLOBALS['db']->query("select price,ecmvat_value,quantity from ecminvoiceoutitems where ecminvoiceout_id='".$id."' and deleted='0'");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w))$total+=$r['price']*$r['quantity']*(1+$r['ecmvat_value']/100);
|
||||
return $total;
|
||||
}
|
||||
function getTotalCorrect($id){
|
||||
$w=$GLOBALS['db']->query("select price,ecmvat_value,quantity,ecminvoiceoutitem_id from ecminvoiceoutitems where ecminvoiceout_id='".$id."'");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$total+=round($r['price']*$r['quantity']*(1+$r['ecmvat_value']/100),2);
|
||||
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select price,ecmvat_value,quantity from ecminvoiceoutitems where id='".$r['ecminvoiceoutitem_id']."'"));
|
||||
$total-=round($rr['price']*$rr['quantity']*(1+$rr['ecmvat_value']/100),2);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
$arr="376,377,378,379,380,381,382,383,384,385,386,387";
|
||||
$e=explode(",",$arr);
|
||||
foreach($e as $ee){
|
||||
$no="FVKOR ".$ee."/10";
|
||||
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id,register_date from ecminvoiceouts where document_no like '".$no."'"));
|
||||
$inv_id=$r['id'];
|
||||
$d="2010-06-10";
|
||||
$total=getTotalCorrect($inv_id);
|
||||
echo "insert into ecmpayments_ecminvoiceouts set paid='0',register_date='".$d."',account_id='134',id='".create_guid()."',ecminvoiceout_id='".$inv_id."',document_no='".$no."',total=".$total.",deleted=0,created_by=1,modified_user_id=1,date_entered='".date("Y-m-d H:i:s")."'
|
||||
,date_modified='".date("Y-m-d H:i:s")."';<br>";
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user