Add php files
This commit is contained in:
48
modules/EcmReceipts2/LoadEcmStockDocCorrects.php
Executable file
48
modules/EcmReceipts2/LoadEcmStockDocCorrects.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
|
||||
|
||||
require_once('modules/EcmReceipts/EcmInvoiceOut.php');
|
||||
|
||||
$source = new EcmReceipt();
|
||||
$source->retrieve($outId);
|
||||
|
||||
if(isset($source->id) && $source->id != '') {
|
||||
|
||||
$pos=$source->getPositionList(true);
|
||||
$focus->name = $source->name;
|
||||
|
||||
/*echo '<pre>';
|
||||
print_r($pos);
|
||||
echo '</pre>';*/
|
||||
|
||||
foreach($pos as $pp){
|
||||
$r=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select quantity,price from ecmreceiptitems where id='".$pp['item_id']."'"));
|
||||
if($pp['quantity']!=$r['quantity']){
|
||||
$rprod=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select name from ecmproducts where id='".$pp['id']."'"));
|
||||
$pname=$rprod['name'];
|
||||
$pp['name']=$pname;
|
||||
$pp['quantity']=$r['quantity']-$pp['quantity'];
|
||||
$ppos[]=$pp;
|
||||
}
|
||||
}
|
||||
|
||||
/*echo '<pre>';
|
||||
print_r($ppos);
|
||||
echo '</pre>';*/
|
||||
|
||||
if(count($ppos) > 0) {
|
||||
$json = getJSONobj();
|
||||
$focus->position_list = str_replace('"','\"',$json->encode($ppos));
|
||||
}
|
||||
$focus->template_id = $source->template_id;
|
||||
$focus->template_name = $source->template_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user