コード例 #1
0
 //开启事务
 $CaiWu = new CaiWu($db);
 //$db->debug=1;
 $db->StartTrans();
 for ($i = 0; $i < sizeof($selectid); $i++) {
     if ($selectid[$i] != "") {
         $huikuaninfo = returntablefield("huikuanrecord", "id", $selectid[$i], "id,customerid,dingdanbillid,jine,oddment,accountid,guanlianplanid");
         $dingdanbillid = $huikuaninfo['dingdanbillid'];
         $shoukuan = $huikuaninfo['jine'];
         $oddment = $huikuaninfo['oddment'];
         $accountid = $huikuaninfo['accountid'];
         $planid = $huikuaninfo['guanlianplanid'];
         $customerid = $huikuaninfo['customerid'];
         //删除回款记录
         if ($shoukuan != 0 || $oddment != 0) {
             $CaiWu->deleteShoukuanReocord($selectid[$i]);
         }
         //回款计划
         if ($planid != '') {
             $sql = "update huikuanplan set ifpay='未回款' where id=" . $planid;
             $db->Execute($sql);
         }
     }
 }
 //是否事务出现错误
 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);