HTML:

<form id="form1">
        <div id="t_border">
            <!--startprint-->
            <div id="first">
                <span id="title">****汽车服务连锁施工单</span>
            </div>
            <table id="TableTitle" style="width:1200px;margin-bottom:10px;">
                <tr>
                    <td id="memberCard"></td>
                    <td id="deName"></td>
                    <td id="orderDate"></td>
                </tr>
                <tr>
                    <td id="memberType"></td>
                    <td id="consumeType"></td>
                    <td id="handleMan"></td>
                </tr>
            </table>

<table id="pTable">
            </table>
            <table id="TableFoot" style="width:1200px;margin-top:10px;">
                <tr>
                    <td id="orderMemo"></td>
                </tr>
                <tr>
                    <td id="workHours"></td>
                    <td id="technician"></td>
                    <td id="payWay"></td>
                </tr>
                <tr>
                    <td id="receiveM"></td>
                    <td id="cutMoney"></td>
                    <td id="totalM"></td>
                </tr>
            </table>
            <table id="custSign">
                <tr>
                    <td>技师签字:________________________</td>
                    <td style="width:420px;"></td>
                    <td>客户签字:________________________</td>
                </tr>
            </table>
            <div id="address">
                <span>地址:****汽车服务连锁</span><span>&nbsp;&nbsp;&nbsp;&nbsp;加盟电话:400-990-8816 / 0371-555111333</span>
                <!-- <span id="printTime"></span> -->
            </div>
            <!--endprint-->
            <div></div>
        </div>
        <div id="dayin">
            <input id="print" type="button" name="print" value="打印" onclick="preview()" />
        </div>
    </form>

JS:

$(function () {

//动态生成打印订单
    var tr = " <tr id=\"title1\"><td  style=\"width: 70px;\">编码</td><td style=\"width: 180px;\">商品名称

</td><td style=\"width: 60px;\">规格</td><td style=\"width: 80px;\">型号</td><td style=\"width: 60px;\">单

位</td><td style=\"width: 60px;\">数量</td> <td style=\"width: 70px;\">单价</td><td style=\"width: 70px;\">

金额</td><td  style=\"width: 80px;\">备注</td></tr>";
    $.parser.parse($("#pTable").html(tr.toString()));

//消费清单列表
    $.post('../Ajax/MemberConsumAjax.ashx?cmd=getMemberCon', { 'mclId': top.jQuery("#printId").val() },

function (result) {
        var result = eval('(' + result + ')');

$.each(result.list, function (i, purList) {
            if (purList.memberType == "非会员") {
                $("#memberCard").text("车主:" + purList.cust_Name);
            } else {
                $("#memberCard").text("会员卡号:" + purList.memberId);
            }
            $("#deName").text("消费门店:" + purList.deName1);

$("#orderDate").text("单据日期:" + purList.or_Date);
            $("#handleMan").text("经手人:" + purList.handleMan);
            $("#memberType").text("会员类型:" + purList.memberType);
            $("#consumeType").text("消费类型:" + purList.consumeType);
            var memo = "";
            if (purList.or_Memo == null) {

$("#orderMemo").text("备注:" + memo);
            } else {
                $("#orderMemo").text("备注:" + purList.or_Memo);
            }
           
            $("#totalM").text("总金额:"+purList.or_TotalM1);
            $("#receiveM").text("应收金额:"+purList.recieveM);
            $("#cutMoney").text("优惠金额:"+purList.cutMoney);
            if (purList.workHours != null) {
                $("#workHours").text("工时:" + purList.workHours);
            } else {
                $("#workHours").text("工时:");
            }
            if (purList.technician != null) {
                $("#technician").text("技师:" + purList.technician);
            } else {
                $("#technician").text("技师:");
            }
            $("#payWay").html("");
            if (purList.memberType == "非会员") {
                var payWay = "";

if (1 == purList.pw_Id1) {
                    payWay += "<input name=\"payWay\" type=\"checkbox\"   disabled=\"disabled\" checked=

\"checked\" />现金";
                }
                if (2 == purList.pw_Id2) {
                    payWay += "<input name=\"payWay\" type=\"checkbox\"   disabled=\"disabled\" checked=

\"checked\" />银行卡";
                }
                if (3 == purList.pw_Id3) {
                    payWay += "<input name=\"payWay\" type=\"checkbox\" disabled=\"disabled\" checked=

\"checked\" />微信";
                }
                if (4 == purList.pw_Id4) {
                    payWay += "<input name=\"payWay\" type=\"checkbox\"   disabled=\"disabled\" checked=

\"checked\" />支付宝";
                }
                if (5 == purList.pw_Id5) {
                    payWay += "<input name=\"payWay\" type=\"checkbox\"  disabled=\"disabled\" checked=

\"checked\" />美团";
                }
                $.parser.parse($("#payWay").html("支付方式:" + payWay.toString()));
            }
            //明细
            $.post('../Ajax/MemberConsumAjax.ashx?cmd=memberConsum', { 'mclId': top.jQuery("#printId").val

(), 'de_Id': purList.de_Id1 }, function (result) {
                var result = eval('(' + result + ')');
                $.each(result.rows, function (i, retail) {
                    var g_Size = "";
                    var g_Version = "";
                    var g_Unit = "";
                    if (retail.g_Size != null) {
                        g_Size = retail.g_Size;
                    }
                    if (retail.g_Version != null) {
                        g_Version = retail.g_Version;
                    }
                    if (retail.g_Unit != null) {
                        g_Unit = retail.g_Unit;
                    }
                    //截取过长的商品名称
                    var g_Name = "";
                    if (retail.g_Name.length > 35) {
                        g_Name = retail.g_Name.substring(0, 20) + "......";
                    } else {
                        g_Name = retail.g_Name;
                    }

tr += " <tr><td>" + retail.g_Code + "</td><td>" + g_Name + "</td><td>" + g_Size +

"</td><td>" + g_Version + "</td><td>" + g_Unit + "</td><td>" + retail.number + "</td><td>" + retail.price +

"</td><td>" + retail.totalMoney + "</td>";
                    if (retail.memo != null) {
                        tr += "<td>" + retail.memo + "</td>";
                    } else {
                        tr += "<td></td>";
                    }
                    tr += "</tr>";
                });
                $.parser.parse($("#pTable").html(tr.toString()));
            });
            return false;
        });
    });
        
    //无预览,直接打印
    if (top.jQuery("#isPreOrPrint").val() == "print") {
        bdhtml = window.document.body.innerHTML;
        sprnstr = "<!--startprint-->";
        eprnstr = "<!--endprint-->";
        prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
        prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
        window.document.body.innerHTML = prnhtml;
        window.print();
    }
});

//打印日期
function PrintTime() {
    var date = new Date();
    var seperator1 = "/";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    var hours = date.getHours();
    var minutes = date.getMinutes();
    var secondes = date.getSeconds();

if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    if (hours >= 0 && hours <= 9) {
        hours = "0" + hours;
    }
    if (minutes >= 0 && minutes <= 9) {
        minutes = "0" + minutes;
    }
    if (secondes >= 0 && secondes <= 9) {
        secondes = "0" + secondes;
    }
    var currentTime = date.getFullYear() + seperator1 + month + seperator1 + strDate + "   " + hours + seperator2 + minutes + seperator2 + secondes;
    return currentTime;
}

//打印
function preview() {
    bdhtml = window.document.body.innerHTML;
    sprnstr = "<!--startprint-->";
    eprnstr = "<!--endprint-->";
    prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
    prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
    window.document.body.innerHTML = prnhtml;
    window.print();
    //prnform.htext.value=prnhtml;
    //prnform.submit();
    //alert(prnhtml);
}
//获取当前日期并格式化
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();

if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
    return currentdate.toString();
}

CSS:

body {font-size: 25px;}

li { float: left;list-style-type: none;}
#t_border {   border: 1px dashed #ccc; width: 1200px; padding: 50px; margin: 50px;}
table { border-collapse: collapse; width: 1200px;margin: 0 0;}
 table td {border: 1px solid #000; text-align: center; height: 35px; line-height: 35px; }
/*表格样式*/
#TableTitle tr td,#TableFoot tr td,#custSign tr td{padding:0; margin:0;border:none ;text-align:left; }
#TableTitle, #TableFoot,#custSign { margin-left:10px;}
#TableFoot { width:1200px;}
#title1 { height: 45px;line-height: 45px;}
#dayin ,#DayIn{ text-align: center;}
#first {  width: 1200px;margin-bottom: 10px;}
#title { font-family: Microsoft YaHei; font-size: 46px;padding-left: 270px;}
#printTime { float: right;}
 #f2 {margin-top:10px;}
#sign {float:right;margin-right:100px;}
#mSign {  margin-top:50px;}
 #address {margin-left:9px;margin-top:20px;}
#pTable {margin-top:5px;}
#reFoot {margin-top: 20px; width: 1200px; margin-left:-40px;}

C#打印单据的更多相关文章

  1. JASPER打印单据,标签开发培训, 界面开发培训

    JASPER打印单据,标签开发培训软件:TIBC JASPER Studio.Jaspersoft Studio是一个专为JasperReports报表引擎而开发的报表设计器,是 iReport设计器 ...

  2. C# 利用PrintDocument定制打印单据

    本文是利用PrintDocument定制打印单据的小例子,仅供学习分享使用,如果不足之处,还请指正. 涉及知识点: PrintDocument :从 Windows 窗体应用程序打印时,定义一种可重用 ...

  3. 打印单据,A4纸,每个单据占一个A4纸,两个单据之间不挨着

    打印单据,A4纸,每个单据占一个A4纸,两个单据之间不挨着 <style type="text/css" media="print">.Noprin ...

  4. VS2012报表(RDLC)系列应用之单据批量打印

    一.前言 最近做的项目需要单据批量打印的功能,优先想到用RDLC来实现.经过Visual Studio几个版本的发展后,RDLC愈发成熟,操作方式也变得简洁,相比vs2005的版本,有质的提升,不过仍 ...

  5. PDA手持机 移动开单进销存系统 现场出打印凭据和扫码 新的亮点

    传统车销模式弊端:1.手写开单,效率低,动作慢2.现场手写开单明细不能打印,产品明细不规范3.电脑办公人员及车销人员对车上的库存情况掌握不清楚,销售人员对每种产品销售价格不清楚4.老板对员工工作的管控 ...

  6. 吉特仓库管理系统-.NET打印问题总结

    在仓储系统的是使用过程中避免不了的是打印单据,仓库系统中包含很多单据:入库单,出库单,盘点单,调拨单,签收单等等,而且还附带着很多的条码标签的打印.本文在此记录一下一个简单的打印问题处理方式.处理问题 ...

  7. FastReport 打印模版页(TFrxReportpage)复制

    遇到一个奇葩的需求.一般情况下我们打印单据,用FastReport设置打印格式,也就是就设一个模版页而己,就是一种单据格式.如果打印的单据数据多了就自动打印多页了,他们的格式是一样的.也就是读同一个模 ...

  8. 车销宝无线开单PDA 一款互联网+POS神器 无缝与电脑数据同步 无线POS开单解决方案

    1.无线POS开单解决方案是基于后台系统开发的一套系统,它实现了采购入库退货.销售出库退货.盘点调拨等功能. 2.系统通过(WIFI.GPRS.GSM.蓝牙)实时后台库存.客户.商品.价格跟踪等信息, ...

  9. XAF点滴:很具体很用实用---处理三个小问题

    以下内容全部为web版本的老模板风格下完成. 一.在编辑状态的详细视图下打印报表. 有些时候,需要在编辑状态下直接打印报表内容,官方默认是不允许这样做的.用Reflector查看源码,可以看到: De ...

随机推荐

  1. 对 django rest framework框架的认识

    - 路由 - 可以通过as_view传参数,根据请求方式不同执行相应的方法 - 可以在url中设置一个结尾,类似于: .json - 视图 - 帮助开发者提供了一些类,并在类中提供了多个方法以供我们使 ...

  2. C# List<Object>值拷贝

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Run ...

  3. python List 常用方法

    list是python常用的数据类型,属于可变的数据类型.用[]表示,里面的元素用','隔开,并且里面的元素类型可以不同,对于每个元素,list都有一个索引一一对应,第一个元素的索引是0,第二个是1, ...

  4. Flask【第7篇】:Flask中的wtforms使用

    flask中的wtforms使用 一.简单介绍flask中的wtforms WTForms是一个支持多个web框架的form组件,主要用于对用户请求数据进行验证. 安装: pip3 install w ...

  5. 连续处理函数reduce

    >>> def operat(x,y): return x*y >>> print reduce(operat,(1,2,3,4,5,6,7,8,9,10))362 ...

  6. 【SaltStack官方版】—— states教程, part 4 - states 说明

    STATES TUTORIAL, PART 4 本教程建立在第1部分.第2部分.第3部分涵盖的主题上.建议您从此开始.这章教程我们将讨论更多 sls 文件的扩展模板和配置技巧. This part o ...

  7. 主席树(静态区间第k大)

    前言 如果要求一些数中的第k大值,怎么做? 可以先就这些数离散化,用线段树记录每个数字出现了多少次. ... 那么考虑用类似的方法来求静态区间第k大. 原理 假设现在要有一些数 我们可以对于每个数都建 ...

  8. 【leetcode】1104. Path In Zigzag Labelled Binary Tree

    题目如下: In an infinite binary tree where every node has two children, the nodes are labelled in row or ...

  9. oracle java for ubuntu apt-get

    oracle java PPA: ppa:webupd8team/javathe key word use for search more infomation: webupd8team

  10. Java冠军程序员告诉你如何提升技术

    让我们跟着兄弟连JavaEE培训 导师,聊一聊——怎样成为冠军程序员 ? 我认为以下几点能力是非常有帮助的: 1.强大的记忆力.当 我上八年级的时候,全因那位死气沉沉的历史老师,让我自己都相信我的记忆 ...