init
This commit is contained in:
22
modules/EcmInvoiceOutOlds/update_prices.php
Normal file
22
modules/EcmInvoiceOutOlds/update_prices.php
Normal 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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user