This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
global $db;
$w=$GLOBALS[db]->query("select id,wz_id,document_no,type,ecminvoiceoutold_id from ecminvoiceoutolds where register_date>='".$_REQUEST['date_from']."%' and register_date<='".$_REQUEST['date_to']."' and deleted='0'");
while($r=$GLOBALS[db]->fetchByAssoc($w)){
//echo $r['document_no'].'<br>';
$ww=$GLOBALS[db]->query("select id,ecmproduct_id from ecminvoiceoutolditems where ecminvoiceoutold_id='".$r['id']."'");
while($rr=$GLOBALS[db]->fetchByAssoc($ww)){
if($r['type']!="normal"){
$rcor=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select wz_id from ecminvoiceoutolds where id='".$r['ecminvoiceoutold_id']."'"));
$r['wz_id']=$rcor['wz_id'];
}
$rrr=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select price from ecmstockoperations where parent_id='".$r['wz_id']."' and product_id='".$rr['ecmproduct_id']."'"));
$purchase_price=$rrr['price'];
echo $rr['code']."<br>";
//if($purchase_price<=0){
$GLOBALS[db]->query("update ecminvoiceoutolditems set purchase_price='".$purchase_price."' where ecminvoiceoutold_id='".$r['id']."' and ecmproduct_id='".$rr['ecmproduct_id']."';");
//echo $purchase_price."<br>";
}
}
?>