Ejemplo n.º 1
0
 for ($i = 0; $i < sizeof($selectid); $i++) {
     if ($selectid[$i] != "") {
         $caigouinfo = returntablefield("caigouorder", "billid", $selectid[$i], "billid,supplyid,accountid,totalmoney,oddment,realmoney");
         $billid = $caigouinfo['billid'];
         $realmoney = $caigouinfo['realmoney'];
         $oddment = $caigouinfo['oddment'];
         $accountid = $caigouinfo['accountid'];
         $supplyid = $caigouinfo['supplyid'];
         $sql = "update caigouorder set state=-1 where billid={$billid} and state>-1";
         $rs = $db->Execute($sql);
         print_r($rs);
         $CaiWu = new CaiWu($db);
         if ($accountid > 0) {
             $CaiWu->operateAccount($accountid, -$realmoney, '采购订金', $billid);
         } else {
             $CaiWu->operatePrepay($supplyid, -$realmoney, '采购订金', $billid);
         }
         if ($oddment != 0) {
             $CaiWu->insertFeiYong(1, -$oddment, $accountid, $_SESSION['LOGIN_USER_ID'], 1, $billid, '');
         }
     }
 }
 //是否事务出现错误
 if ($db->HasFailedTrans()) {
     print "<script language=javascript>alert('错误:" . str_replace("'", "\\'", $db->ErrorMsg()) . "');window.history.back(-1);</script>";
 } else {
     page_css("");
     $return = FormPageAction("action", "init_default");
     //print_infor("采购订单成功删除",'trip',"location='?$return'","?$return",0);
 }
 $db->CompleteTrans();