$_GET['action'] = "savechuku";
            $_GET['rowid'] = $_GET['billid'];
        }
    }
}
if ($_GET['action'] == "savechuku") {
    $rowid = $_GET['rowid'];
    try {
        $Store = new Store($db);
        //$db->debug=1;
        //开启事务
        $db->StartTrans();
        //确认出库
        $Store->confirmChuKu($rowid);
        //创建发货单
        $Store->insertFaHuo($rowid);
        //是否事务出现错误
        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();
        exit;
    } catch (Exception $e) {
        print "<script language=javascript>alert('错误:" . $e->getMessage() . "');window.history.back(-1);</script>";
        exit;
    }
}
     $shoukuan = floatval($_POST['shoukuan']);
     $opertype = '';
     if ($_POST['ifpay'] == 1) {
         //付全款
         $opertype = '货款收取';
     } else {
         //付押金
         $opertype = '收押金';
     }
     //插入新回款记录
     if ($shoukuan != 0 || $oddment != 0) {
         $CaiWu->insertShoukuanReocord($customerid, $billid, $shoukuan, $accountid, $_SESSION['LOGIN_USER_ID'], $opertype, $oddment);
     }
     //发货
     if ($billinfo['fahuostate'] == 0 && $chukubillid > 0) {
         $Store->insertFaHuo($chukubillid, $customerid, $billid, $shouhuoren, $mobile, $address);
     }
     //开票
     if ($billinfo['kaipiaostate'] == 0 && $shoukuan + $oddment != 0) {
         $CaiWu->insertKaiPiao($customerid, $billid, $fapiaoneirong, $fapiaotype, $fapiaono, $shoukuan + $oddment, $_SESSION['LOGIN_USER_ID']);
     }
     $db->CompleteTrans();
     page_css("店面销售单");
     //是否事务出现错误
     if ($db->HasFailedTrans()) {
         throw new Exception($db->ErrorMsg());
     } else {
         $return = FormPageAction("action", "init_default");
         print_infor("店面销售单执行完成", 'trip', "location='?{$return}'", "?{$return}", 0);
     }
 } catch (Exception $e) {