修改舒文,牌位预览列印

This commit is contained in:
2025-09-17 17:31:34 +08:00
parent c38dc55dff
commit 104f95eaec
11 changed files with 214 additions and 187 deletions

View File

@@ -19,53 +19,24 @@ public partial class admin_printpw_index : MyWeb.function
private string previousOrderno = "";
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write("item:"+Request["item"]+"<br>");
//Response.Write("file:"+Request["file"]+"<br>");
//Response.Write("list:"+Request["list"]+"<br>");
//if (!IsPostBack)
//{
this.Title = "預覽牌位";
if (Request.HttpMethod == "POST")
{
/*if (!String.IsNullOrEmpty(Request["item"]) &&
!String.IsNullOrEmpty(Request["file"]) &&
!String.IsNullOrEmpty(Request["list"])
)*/
if (!String.IsNullOrEmpty(Request["order_no"]))
{
var order_no = Request["order_no"];
var oderList = _db.pro_order_detail
.Where(u => u.order_no == order_no && u.printed_files != null)
.Where(u => u.order_no == order_no)
.Where(u => (u.parent_num != null)
|| u.actItem.subject.Contains("牌")
|| !string.IsNullOrEmpty(u.f_num_tablet))
//因為目前在[pro_order_detail]表中,沒有辦法區分那些項目是牌位,
//只有根據某些欄位來做部分篩選,可能會篩選錯
//但是為什麼沒有欄位可以區分一個項目是不是牌位呢?
.Select(u => new { detail_num = u.num, actItem_num = u.actItem_num }).ToArray();
Repeater1.DataSource = oderList;
Repeater1.DataBind();
}
else if (!String.IsNullOrEmpty(Request["activity_num"]))
{
//var _details = Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>(Request["list"]);
//string json = "";
//using (System.IO.StreamReader oSR = new System.IO.StreamReader(Request.InputStream))
// json = oSR.ReadToEnd();
int activity_num = Convert.ToInt32(Request["activity_num"]);
//Repeater1.DataSource = _details;
var orderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(u => u.order_no).ToList();
var gdzOrderList = _db.pro_order_detail.Where(u => orderList.Contains(u.order_no) && u.print_id.Contains("主") ).Select(u=>u.order_no).Distinct().ToArray();
var datalist = _db.pro_order_detail
.Where(u => gdzOrderList.Contains(u.order_no) && u.print_id.Contains("主") && u.parent_num != null && u.printed_files != null)
.OrderBy(o => o.order_no)
.ThenBy(o => o.actItem_num)
.ThenBy(o=>o.print_id)
.Select(u => new {detail_num=u.num ,actItem_num=u.actItem_num})
.ToArray();
//List<int> ints = new List<int>();
//ints.Add(12133);
Repeater1.DataSource = datalist;
Repeater1.DataBind();
if (!String.IsNullOrEmpty(Request["title"]))
{
this.Title += " - " + Request["title"];
}
}
else
{
Response.Clear();
@@ -74,9 +45,6 @@ public partial class admin_printpw_index : MyWeb.function
}
}
//}
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
@@ -248,8 +216,8 @@ public partial class admin_printpw_index : MyWeb.function
catch (Exception ex)
{
var msg = ex.Message;
ret[0] = "??:" + msg;
ret[1] = "??";
ret[0] = "";
ret[1] = "";
}
return ret;
}

View File

@@ -24,6 +24,8 @@
@page a4l {
size: a4 landscape;
margin: 0;
margin-top:6mm;
margin-left:6mm;
}
@page a5 {
@@ -133,6 +135,22 @@ pre {
line-height: calc(var(--fs_w) * 1.0);
}
.text-block.fit-text.add-space {
letter-spacing: 0.5em;
}
.text-block.fit-text.mid_text.add-space {
padding-top: 0.5em;
}
.text-block.fit-text.mid_text.add-space.add-space-3 {
letter-spacing: 1.5em;
padding-top: 1.5em;
}
body.tblt-m .left_text {
--font-max: 30pt;
}
body.tblt-m .top_text_2 {
right: 8mm;
}
.vertical {
writing-mode: vertical-rl;
/*text-orientation: upright;*/
@@ -367,6 +385,10 @@ pre {
left: 2mm;
}
.top_text_3 {
display: none;
}
/*舊式紙張*/
body.tablet-l {
--page-w: 274mm;
@@ -548,6 +570,9 @@ body.tblt-l.a3.l2b .mid_text {
--divh: 60mm;
top: 40%;
}
body.tblt-l.a3 .left_text {
--font-max: 36pt;
}
body.tblt-l.a3.l2b .mid_text_2 {
--divh: 180mm;
@@ -638,7 +663,8 @@ body.tblt-m.a4-mrg {
}
body.tblt-m.a4-mrg .page {
--page-w: 100mm;
--page-w: 95mm;
margin-left:5mm;
float: left;
}
@@ -763,9 +789,8 @@ body.tblt-xs {
}
body.tblt-xs.a3-mrg .page {
/*--page-w: 57mm;*/
--page-w: 59mm;
--page-h: 100mm;
--page-w: 57mm;
--page-h: 98mm;
page-break-after: auto;
float: left;
}
@@ -775,13 +800,11 @@ body.tblt-xs.a4l-mrg {
}
body.tblt-xs.a4l-mrg .page {
/* --page-w: 57mm; */
--page-w: 59mm;
--page-h: 100mm;
--page-w: 57mm;
--page-h: 98mm;
page-break-after: auto;
float: left;
}
body.tblt-xs .top_text_1 {
font-size: 8pt;
}
@@ -800,9 +823,9 @@ body.tblt-xs .mid_text_2 {
}
body.tblt-xs .right_text {
--divw: 12mm;
--divw: 10mm;
--divh: 60mm;
right: 0mm;
right: 2mm;
top: 25mm;
}
@@ -825,8 +848,7 @@ body.tblt-xs .top_text_2{
/*[標準X2B]隨喜牌位-佛力超薦-往生蓮位-A3(直)*/
right: 2mm;
right: 3.0mm;
right: 3.5mm;
/* right: 4.0mm; */
right: 5mm;
}
body.tblt-xs .txt_up {
@@ -1075,35 +1097,4 @@ body.prayer-h pre {
/*[標準X1A]隨喜牌位-佛光注照-長生祿位-A4(橫) */
* {
outline:0 none !important;
}
/*让自定义的分页生效在某个div后面产生class-page从而分页当牌位不是同一家人的时候就分页*/
@media print {
.page-break {
display: block !important;
width: 100%;
height: 1px;
visibility: hidden;
page-break-after: always;
}
.page {
page-break-inside: auto !important;
}
@page {
orphans: 1;
widows: 1;
}
.d-flex {
display: block !important;
}
.page-break::after {
content: "";
display: block;
height: 1px;
visibility: hidden;
}
}
}

View File

@@ -32,17 +32,25 @@ function init_print() {
//console.log(i, $(this).html(),$(this).text());
//console.log(i, txt==htm);
//console.log(i, txt_arr, line, line_len);
line_len = Math.ceil(line_len / 5) * 5;
line_len = Math.ceil(line_len / 3) * 3;
//if(line>1){
css = $(this).attr("style")||"";
if(css.length>0){
css += ";";
}
css += "--lines:" + line + ";--line_len:" + line_len + ";";
//debugger;
//字少時, 加空間
let allShort = txt_arr2.every(line => line.trim().length <= 7);
let addSpaceClass = allShort ? "add-space" : "";
allShort = txt_arr2.every(line => line.trim().length <= 3);
addSpaceClass += allShort ? " add-space-3" : "";
htm_lines = txt_arr2.join("<br>");
$(this).attr("style", css);
$(this).html(htm_lines);
$(this)
.attr("style", css)
.addClass(addSpaceClass)
.html(htm_lines);
//}
//console.log(i, line, line_len, css,txt);
});

View File

@@ -153,6 +153,9 @@
<template #item.slot_type ="{item}">
{{item.detail.actItem?.substring(0,3)}}
</template>
<template #item.up_time ="{item}">
{{item.up_time|timeString('YYYY-MM-DD')}}
</template>
<template #item.print="{item}">
<v-icon color="blue" class="mr-2" @click="yulan_single(item);" >
mdi-printer