標籤:class code tar ext c string
$.ajax({
url: baseURL + "InvoiceSale/OnQuotaInvoiceSale", //點擊核銷單號時,點擊核銷時,互動的頁面
type: "POST",
data: JSON.stringify(createTable.resultData()), //JSON傳遞整個表格式資料,得到字串數組
dataType: "json",
success: function (result) {
Success(result)
},
error: function () {
alert("error");
}
});
//在初始載入時,遍曆填充表格
loadData: function (data) {
var $table = $("#tableAgainDetail"),
$trFirst = $("#trDetailFirst");
$table.find("tr").each(function (i) {
if (i > 2) {
$(this).remove();
}
});
if (!!data) {
$.each(data, function (i, info) {
$tr = $trFirst.clone().attr("id", "").show();
$tr.children("td").eq(0).text("00");
//$tr.val(info.LaneID);
//$tr.children("td").eq(1).text(info.SquadNo);
$table.append($tr);
});
}
$("input[name=spaninvoiceCode]:visible").live("blur", function () {
var flags = false, $this = $(this);
if ($(this).val().length != 12) {
$(this).css("background", "#FDB7BF");
$(".tooltip_main").text("發票代碼應為12位");
$("#tips").show().css("left", $this.parent()[0].offsetLeft).css("top", $this.parent()[0].offsetTop + 121);
flags = true;
}
if (flags) {
return false;
}
$(this).css("background", "#FFFFFF");
$("#tips").hide();
});
$("input[name=‘spanstartNo‘]:visible,input[name=‘spanendNoT‘]:visible").live("blur", function () {
var flags = false, $this = $(this);
if ($(this).val().length < 6 || $(this).val().length > 8) {
$(this).css("background", "#FDB7BF");
$(".tooltip_main").text("起\止號長度應為6-8位");
$("#tips").show().css("left", $this.parent()[0].offsetLeft).css("top", $this.parent()[0].offsetTop + 121);
flags = true;
}
if (flags) {
return false;
}
$(this).css("background", "#FFFFFF");
$("#tips").hide();
});
$("input[name=‘spanstartNo‘],input[name=‘spanendNoT‘],.can,.cuo").live(‘keyup‘, function () {
if (createTable.isNum($(this))) {
createTable.calTrCount($(this).parent().parent());
} else {
$("#spanMsg").text("請輸入數字");
}
$("#spanMsg").text("");
});
},
//迴圈資料,得到JSON數組,拼成Jason數組,傳個後台
resultData: function () {
var $tr = $("#tableAgainDetail").find("tr:visible"),
result = [],
trData = {},
//OprID = [], DefinedOn = [], laneID = [],
spaninvoiceCode = [], spanstartNo = [], spanendNoT = [],
amount = [], can = [], cuo = [], actual = [];
/*擷取資料後,迴圈向表格中添加資料*/
$.each($tr, function (i, info) {
var $this = $(this), $tds = $this.children("td");
if ($tds.length == 0) {
return true;
}
/*如果TD的長度==8,擷取傳來的收費員編號,以及日期時間*/
if ($tds.length == 8) {
trData = {},laneID=[], spaninvoiceCode = [], spanstartNo = [], spanendNoT = [],
amount = [], can = [], cuo = [], actual = [];
trData.oprID = $("#txtOprID").val(); //收費員編號
trData.definedOn = $("#txtDefinedOn").val(); //日期時間
trData.laneID = "0";
}
//money.push($this.find("select[name=‘money‘]").val()); //選擇票面金額
spaninvoiceCode.push($this.find("input[name=‘spaninvoiceCode‘]").val()); //發票代碼
spanstartNo.push($this.find("input[name=‘spanstartNo‘]").val()); //起號
spanendNoT.push($this.find("input[name=‘spanendNoT‘]").val()); //止號
amount.push($this.find(".amount").text()); //張數
can.push($this.find("input[class=‘can‘]").val()); //殘票
cuo.push($this.find("input[class=‘cuo‘]").val()); //錯票
actual.push($this.find(".actual").text()); //實際發出
//trData.money = money.join();
trData.spaninvoiceCode = spaninvoiceCode.join();
trData.spanstartNo = spanstartNo.join();
trData.spanendNoT = spanendNoT.join();
trData.amount = amount.join();
trData.can = can.join();
trData.cuo = cuo.join();
trData.actual = actual.join();
result.push(trData);
});
return result;
},