+
@@ -78,6 +79,10 @@
options: { multiSort: false },
search_options: { multiSort: false },
isModalOpen: false,
+ receiptComponent: {
+ order_no: "",
+ total_amt:0
+ },
search: {},
data_table: {
loading: true,
@@ -118,8 +123,10 @@
this.loadData()
}
},
- openReceipt() {///開收據
+ openReceipt(item) {///開收據
this.openModal();
+ this.receiptComponent.order_no = item.order_no;
+ this.receiptComponent.total_amt = item.total_amt;
},
gotoAdd() {
this.$emit('custom-event', { action: 'add' });
diff --git a/web/admin/print/TabletDesign.aspx b/web/admin/print/TabletDesign.aspx
index f85686f..624ba4d 100644
--- a/web/admin/print/TabletDesign.aspx
+++ b/web/admin/print/TabletDesign.aspx
@@ -1384,27 +1384,7 @@ html, body, * {
html = this.renderNameList(slice, el, 0);
}
else if (el.id === 'alive') {
- //console.log("createEl:", slice, el)
- //let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
- //let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
- //let rowWidth = Math.floor(Number(el.width) / rows);
- //fontSize = Math.floor(rowWidth / 2);
- //if (fontSize > el.style.fontSize) {
- // fontSize = el.style.fontSize;
- // rowWidth = fontSize * 2;
- //}
- //let th = Number(el.textHeight) || 0;
- //let span = Number(el.textSpan) || 0;
- //let h = Number(el.height);
- //let w = Number(el.width);
- //let namesPerCol = Math.floor((h + span) / (th + span));
- //if (namesPerCol < 1) namesPerCol = 1;
-
- //// 2. 計算總共會產生幾列 (cols),並推算出每個名字能分配到的最大欄寬
- //let cols = Math.ceil(slice.length / namesPerCol);
- //if (cols < 1) cols = 1;
- //let colWidth = Math.floor(w / cols);
html = this.renderLiveList(slice, el);
}
else {
@@ -1490,63 +1470,6 @@ html, body, * {
let s = Number(el.style.fontSize);
let sizes = [];
- //// 1. 模擬排版:找出能讓全體塞入的最佳字體組合
- //while (s >= 12) {
- // let short_s_px = s * 1.333;
- // let long_s = Math.floor(s * 0.75); // 長字體最多縮小 25%
- // if (long_s < 12) long_s = 12;
- // let long_s_px = long_s * 1.333;
-
- // let currentColHeight = 0;
- // let totalWidth = 0;
- // let tempSizes = [];
-
- // for (let i = 0; i < names.length; i++) {
- // let name = names[i];
- // let l = name.length;
- // let isMulti = (l * short_s_px) > th;
-
- // let size = isMulti ? long_s : s;
- // let size_px = isMulti ? long_s_px : short_s_px;
-
- // tempSizes.push({ name: name, size: size, isMulti: isMulti });
-
- // if (isMulti) {
- // // 多行長名
- // let charsPerCol = Math.floor(h / size_px);
- // if (charsPerCol < 1) charsPerCol = 1;
- // let lines = Math.ceil(l / charsPerCol);
- // let nameW = lines * (size_px * 1.1); // 1.1倍行距
-
- // if (currentColHeight > 0) currentColHeight = 0;
- // totalWidth += nameW + gap;
- // } else {
- // // 單行短名
- // if (currentColHeight > 0 && (currentColHeight + th + gap) <= h) {
- // currentColHeight += th + gap;
- // } else {
- // currentColHeight = th;
- // totalWidth += short_s_px + gap;
- // }
- // }
- // }
-
- // if (totalWidth > 0) totalWidth -= gap;
-
- // // 總寬度未爆框,確定最佳組合
- // if (totalWidth <= w) {
- // sizes = tempSizes;
- // break;
- // }
- // s -= 1;
- //}
-
- //// 處理極端情況
- //if (sizes.length === 0) {
- // sizes = names.map(name => {
- // return { name: name, size: 12, isMulti: (name.length * 12 * 1.333) > th };
- // });
- //}
// 1. 模擬排版:找出能讓全體塞入的最佳字體組合
while (s >= 12) {
let short_s_px = s * 1.333;
@@ -1806,7 +1729,7 @@ html, body, * {
display: "block",
"min-height": `${th}px`, // ★ 固定分配高度,交給 Flexbox 自動排版
"max-height": `${el.height}px`,
- width: `${fontSize * 1.33}`,
+ width: "auto",//`${fontSize * 1.33}`,
//"line-height": "1.1",
"text-align": "justify", // 統一分散對齊
"text-align-last": "justify",
diff --git a/web/admin/print/print_multi_new.aspx b/web/admin/print/print_multi_new.aspx
index cab2a1b..0d3c6e9 100644
--- a/web/admin/print/print_multi_new.aspx
+++ b/web/admin/print/print_multi_new.aspx
@@ -168,10 +168,6 @@
} else {
$("#paperSizeSel").val("0001");
}
- //$("#paperSizeSel").trigger('change');
- //this.render();
- //this.print();
- //this.isInit = false;
}
);
},
@@ -184,7 +180,6 @@
if (data.result == "Y") {
let details = data.data;
this.allStyleDetails = details;
- //console.log(data.data);
}
}
}
@@ -195,23 +190,16 @@
await axios
.post(this.http_host + 'api/tablet/GetPaperSize', {})
.then(response => {
- //if (response.result=="Y") {
if (response.status == "200") {
let data = response.data;
this.allSize = data.data;
- //console.log(this.allSize);
if (this.allSize) {
this.allSize.forEach(x => {
$("#paperSizeSel").append(`
`);
})
- //if (this.printSize) {
- // $("#paperSizeSel").val(this.printSize);
- //} else {
- // $("#paperSizeSel").val("0003")
- //}
}
}
- //$("#paperSizeSel").val("0003");
+
}
)
},
@@ -219,7 +207,6 @@
await axios
.post(this.http_host + 'api/tablet/GetTabletElement', {})
.then(response => {
- //if (response.result=="Y") {
if (response.status == "200") {
let data = response.data;
this.tabletElement = data.data;
@@ -250,7 +237,6 @@
if (response.status == 200) {
this.printData = response.data;
- //console.log("printData:",this.printData);
this.printData.sort(function (a,b) {
if (a.print_id < b.print_id) {
return -1
@@ -259,16 +245,10 @@
}
return 0
});
- //this.render();
- //this.print();
}
});
},
render() {
- //console.log(this.pSize)
- //if (this.isInit) {
- // return false;
- //}
$("#printArea").empty();
let self = this;
let canvas = $(`
`)
@@ -283,54 +263,42 @@
}
}
let pageSize = self.allSize.find(y => y.paperID == $("#paperSizeSel").val());
-
+ let wrap = $("
")
+ let mode = "origin"
this.printData.forEach(x => {
+
let style = self.allStyle.find(y => y.styleID == x.style);
//用來印內容的尺寸
- console.log("style.paperSize:", style.paperSize)
+ //console.log("style.paperSize:", style.paperSize)
let size = self.allSize.find(y => y.paperID == style.paperSize);
//包含空白用來折的尺寸
let printSize = self.allSize.find(y => y.paperID == style.printSize);
let xCount = 1;
let yCount = 1;
-
+ mode = style.printMode
let total = 1;
if (style.printMode === "combine") {
//用長根寬算出一張紙可以印幾張
- xCount=parseFloat(pageSize.width) / parseFloat(size.width);
- yCount=parseFloat(pageSize.height) / parseFloat(size.height);
+ xCount=parseFloat(Number(pageSize.width)) / parseFloat(Number(size.width));
+ yCount=parseFloat(Number(pageSize.height)) / parseFloat(Number(size.height));
total=Math.floor(xCount) * Math.floor(yCount);
}
- console.log("xCount,yCount:",xCount,yCount)
- //if ((nowPageWidth + parseFloat(printSize.width)) > pageSize.width) {
if (nowPageWidth >= total) {
- //$(canvas).css("width", printSize.width + "mm");
- //$(canvas).css("height", printSize.height + "mm");
- //$(canvas).css("justify-content", "center");
- //$(canvas).css("break-after", "page");
- //$(canvas).css("page-break-after", "always");
- $(canvas).append(tabletpaper);
- $("#printArea").append(canvas);
- canvas = $(`
`)
+ $(wrap).append(tabletpaper);
+ if (style.printMode !== "combine") {
+ $(canvas).append(wrap);
+ $("#printArea").append(canvas);
+ wrap = $("
")
+ canvas = $(`
`)
+ }
nowPageWidth = 0;
}
nowPageWidth = nowPageWidth + 1; //parseFloat(printSize.width);
- tabletpaper = $(`
+ tabletpaper = $(`
`)
let img = self.bg.find(y => y.name == style.backendImg);
- /*tabletpaper.css({
- "background-color": "white",
- width: size.width + 'mm',
- height: size.height + 'mm',
- position: "relative",
- "margin-bottom": "0",
- "background-image": `url(${img.path})`,
- 'background-size': '100% 100%',
- "break-after": "page",
- "page-break-after": "always"
- });*/
let tablet = JSON.parse(x.f_num_tablet);
let mid_items = tablet.mid_items;
@@ -477,7 +445,6 @@
});
sizes.forEach(item => {
let th = Number(d.textHeight) || Number(d.height)
- //let minH = item.isMulti ? `${d.height}px` : `${d.textHeight}px`;
let minH = item.isShort ? `${th}px` : `${d.height}px`
;
let alignStyle = item.isMulti ? "start" : "justify";
@@ -496,115 +463,11 @@
});
$namelist.append($span);
});
- //let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
- //let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
- //let rowWidth = Math.floor(Number(d.width) / rows);
- //newFontSize = Math.floor(rowWidth / 2);
- //if (newFontSize > d.fontSize) {
- // newFontSize = d.fontSize;
- // rowWidth = newFontSize * 2;
- //}
- //let th = Number(d.textHeight) || 0;
- //let span = Number(d.textSpan) || 0;
- //let h = Number(d.height);
- //let w = Number(d.width);
-
- //let namesPerCol = Math.floor((h + span) / (th + span));
- //if (namesPerCol < 1) namesPerCol = 1;
-
- //// 2. 計算總共會產生幾列 (cols),並推算出每個名字能分配到的最大欄寬
- //let cols = Math.ceil(mid.length / namesPerCol);
- //if (cols < 1) cols = 1;
- //let colWidth = Math.floor(w / cols);
- //let $namelist = $(`
`).css({
- // "writing-mode": "vertical rl",
- // display: "flex",
- // "flex-direction": "row",
- // "flex-wrap": "wrap",
- // margin: "auto",
- // width: `${d.width}px`,
- // height: `${d.height}px`,
- // border: "0px solid #ccc",
- // padding: "1px",
- // "font-family": style.fontFamily,
- // //"letter-spacing": "0.1em",
- // "column-gap": `${d.textSpan}px`,
- // //"row-gap": "1px",
- // "align-items": "center",
- // "justify-content": "start",
- //});
-
- //mid.forEach(z => {
- // //let info = self.getTextInfo(z, newFontSize);
- // //let spanWidth = mid.length > 1 ? newFontSize : d.width
- // //let height = d.textHeight;
- // //if (info.height >= d.textHeight) {//width
- // // height = d.height;
- // //}
- // //let $span = $(`
${z}`).css({
- // // display: "block",
- // // "min-height": `${height}px`,
- // // "max-height": `${d.height}px`,
- // // "max-width": `${rowWidth}px`,
- // // //width: `${newFontSize}px`,
- // // "text-align": "justify",
- // // "text-align-last": "justify",
- // // //"margin-bottom": "20px",
- // // "margin-left": "5px",
- // // "text-justify": "inter-character",
- // // "white-space": "pre-line",
- // // //"justify-content":"center"
- // //});
- // let indSize = this.calcIndividualFontSize(z, d, colWidth);
- // // 2. 判斷是否發生了折行 (名字長度 * 單字像素高度 > 分配到的最大高度)
- // let s_px = indSize * 1.333;
- // let isMultiLine = (z.length * s_px) > Number(d.textHeight);
-
- // // 3. 根據是否折行動態決定對齊方式
- // // 單行:分散對齊 (justify) / 多行:置中對齊 (center) 或是改為 靠上對齊 (start)
- // let alignStyle = isMultiLine ? "start" : "justify";
- // let $span = $(`
${z}`).css({
- // display: "block",
- // "min-height": `${d.textHeight}px`,
- // "max-height": `${d.height}px`,
- // width: "auto",
- // "line-height": "1.1",
- // "text-align": alignStyle, // ★ 動態套用對齊方式
- // "text-align-last": alignStyle, // ★ 動態套用最後一行對齊方式
- // "margin-left": "5px",
- // "text-justify": "inter-character",
- // "word-break": "break-all"
- // });
- // $namelist.append($span);
- //});
-
+
html = $namelist;
} else if (d.elementID === "alive") {
- //let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
- //let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
- //let rowWidth = Math.floor(Number(d.width) / rows);
- //newFontSize = Math.floor(rowWidth / 2);
- //if (newFontSize > d.fontSize) {
- // newFontSize = d.fontSize;
- // rowWidth = newFontSize * 2;
- //}
- //let th = Number(d.textHeight) || 0;
- //let span = Number(d.textSpan) || 0;
- //let h = Number(d.height);
- //let w = Number(d.width);
- //let namesPerCol = Math.floor((h + span) / (th + span));
- //if (namesPerCol < 1) namesPerCol = 1;
-
- //// 2. 計算總共會產生幾列 (cols),並推算出每個名字能分配到的最大欄寬
- //let cols = Math.ceil(left.length / namesPerCol);
- //if (cols < 1) cols = 1;
- //let colWidth = Math.floor(w / cols);
-
-
html = self.renderLiveList(left, d);
-
- //newFontSize = d.fontSize;
} else if (d.elementID === "titletriangle") {
newFontSize = self.scaleFontSize(mid, d.fontSize, d.width);
html = self.renderRoster(mid, d)
@@ -648,16 +511,21 @@
})
let content = $(`
`)
.css({
- position: "absolute", left: "1mm", top: "5mm", fontSize: '16px',
+ position: "absolute", right: "0mm", top: "0mm", fontSize: '16px',
"z-index": 9999,
"align-items": "center"
})
.html(x.print_id);
tabletpaper.append(content);
- //console.log("xCount:", Math.floor( xCount));
let xFloor = Math.floor(xCount);
+ let totalPrWidth = printSize.width
+
+
+ if (xFloor > 1) {
+ totalPrWidth = Number(size.width) * Number(xFloor)+3
+ }
self.pageStyle = `