2 require_once 'Pman/Roo.php';
4 class Pman_Xtuple_VoidSalesAndPurchaseOrders extends Pman_Roo
8 if (HTML_FlexyFramework::get()->cli) {
11 return parent::getAuth();
16 $this->transObj = DB_DataObject::Factory('cohead');
18 $this->transObj->query('BEGIN');
20 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
22 $cohead = DB_DataObject::factory('cohead');
28 $cohead->orderBy('cohead_id DESC');
31 while ($cohead->fetch()){
32 $co = clone ($cohead);
34 $cobmiscs = $co->cobmiscs();
36 foreach ($cobmiscs as $cobmisc){
37 $cobapply = DB_DataObject::factory('cobapply');
38 $cobapply->cobapply_cobmisc_id = $cobmisc->pid();
40 if($cobapply->count()){
42 foreach($cobapply->fetchAll() as $coba){
47 $checkitem = DB_DataObject::factory('checkitem');
48 $checkitem->autoJoin();
49 $checkitem->checkitem_aropen_id = $coba->cobapply_aropen_id;
50 print_r($checkitem->fetchAll());exit;
51 $checkitem->whereAdd("
52 join_checkitem_checkhead_id_checkhead_id.checkhead_posted = TRUE
54 join_checkitem_checkhead_id_checkhead_id.checkhead_void = FALSE
56 join_checkitem_checkhead_id_checkhead_id.checkhead_deleted = FALSE
59 print_r($checkitem->fetchAll());exit;
60 foreach ($checkitem->fetchAll() as $checki){
61 $checkhead = $checki->checkhead();
62 $checkhead->voidPostedCheck($this);
72 $this->jerr('ROLL BACK');