4 * fill in any fifo basic entries that have not been processed..
5 * -- does not fill in values.. - just qty's
8 require_once 'ProcessBase.php';
10 class Pman_Xtuple_Fifo_FixVoids extends Pman_Xtuple_Fifo_ProcessBase
13 static $cli_desc = "Fill some void records - do not normmally run...";
15 static $permitError = false;
19 $ff = HTML_FlexyFramework::get();
21 die("run form cli only");
29 // set up the failure code..
31 die("not needed any more -- done on HK?? - needs testing on SG??");
33 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
34 //DB_DataObject::debugLevel(1);
35 $id = DB_DataObject::Factory('invdetail');
38 $id->selectAdd( 'distinct(invhist_ordnumber) as ordernum');
39 $id->whereAdd(" invhist_transtype ='RS' AND invdetail_qty < 0 and invfifo_void =0 ");
40 $ons = $id->fetchAll('ordernum');
43 foreach($ons as $n => $oid) {
46 // find the last insue and reverse it..
47 $id = DB_DataObject::Factory('invdetail');
50 $id->whereAdd("invhist_ordnumber = '$oid'");
51 $id->whereAdd("invhist_transtype = 'SH' AND invdetail_qty < 0");
52 $id->orderBy('invdetail_id DESC');
54 if (!$id->find(true)) {
57 $id->reverse($this,array(
60 // now find the one I've just create it and reverse it..
61 $id = DB_DataObject::Factory('invdetail');
64 $id->whereAdd("invhist_ordnumber = '$oid'");
65 $id->whereAdd("invhist_transtype = 'RS' AND invdetail_qty > 0");
66 $id->orderBy('invdetail_id DESC');
68 if (!$id->find(true)) {
71 $id->reverse($this,array(