B/S打印条码(TDP643测试通过)

来源:互联网 发布:软件行业例会 编辑:程序博客网 时间:2024/05/16 16:16

    <script language="javascript" type="text/javascript">
        function Print()
        {
            var Filed1="";
            var Filed2="";
            var Filed3="";
            var Filed4="";
            var Filed5="";
            var Filed6="";
            var Filed7="";
            var Filed8="";
            var Filed9="";
            var Filed10="";
            var Filed11="";
            var Filed12="";
            var PageSet="";
            var barval="";
                              
                    var enterkey  = String.fromCharCode(13);
                    var quoteskey  = String.fromCharCode(34);
                    var realkey  = String.fromCharCode(94);
                    var xiexian=String.fromCharCode(47);
                   
                    barval= barval+ PageSet + enterkey;
                    barval= barval+"GAP 2 mm,0" + enterkey;
                    barval= barval+"SPEED 8" + enterkey;
                    barval= barval+"DENSITY 8" + enterkey;
                    barval= barval+"DIRECTION 1" + enterkey;
                   
                    barval= barval+"CLS" + enterkey;
                    ///////////////////////////////////////////////////////////////////////////
                    //固定资产管理卡(文字)
                    barval= barval+"@1="+ quoteskey+"固定资产管理卡"+ quoteskey + enterkey;
                    //购置日期(文字)
                    barval= barval+"@2="+ quoteskey+"购置日期:"+ quoteskey + enterkey;
                    //购置日期(内容)
                    barval= barval+"@3="+ quoteskey+ Filed10.substring(0,10) + quoteskey + enterkey; 
                    //资产代码(文字)
                    barval= barval+"@4="+ quoteskey+"资产代码"+ quoteskey + enterkey;
                    //资产代码(内容)
                    barval= barval+"@5="+ quoteskey+ Filed1.substring(Filed1.length-5) + quoteskey + enterkey;
                    //设备型号(文字)
                    barval= barval+"@6="+ quoteskey+"设备型号"+ quoteskey + enterkey;
                    //设备型号(内容)
                    barval= barval+"@7="+ quoteskey+ Filed5 + quoteskey + enterkey;
                    //品牌型号(文字)
                    barval= barval+"@8="+ quoteskey+"品牌型号"+ quoteskey + enterkey;
                    //品牌型号(内容)
                    barval= barval+"@9="+ quoteskey+ Filed6 +"/" + Filed7 + "/" +  Filed8 + quoteskey + enterkey;
                    //责任人(文字)
                    barval= barval+"@10="+ quoteskey+"责任人"+ quoteskey + enterkey;
                    //责任人(内容)
                    barval= barval+"@11="+ quoteskey+ Filed9 + quoteskey + enterkey;
                    //部门(文字)
                    barval= barval+"@12="+ quoteskey+"部门"+ quoteskey + enterkey;
                    //部门(内容)
                    barval= barval+"@13="+ quoteskey+ Filed12 + quoteskey + enterkey;
                    //单位(文字)
                    barval= barval+"@14="+ quoteskey+"单位"+ quoteskey + enterkey;
                    //单位(内容)
                    barval= barval+"@15="+ quoteskey+ Filed11 + quoteskey + enterkey;
                    //设备序号(文字)
                    barval= barval+"@16="+ quoteskey+"设备序号"+ quoteskey + enterkey;
                    //主机编号(内容)
                    barval= barval+"@17="+ quoteskey+ Filed3 + quoteskey + enterkey;
                    //显示器编号(内容)
                    barval= barval+"@18="+ quoteskey+ Filed4 + quoteskey + enterkey;
                    ////////////////////////////////////////////////////////////////////////////
                  
                    barval= barval+"BOX 50,30,700,800,5" + enterkey;
                        //固定资产管理卡(文字)
                        barval= barval+"TEXT 130,150," + quoteskey+"TSS24.BF2" + quoteskey + ",0,3,3,@1"  + enterkey;
                        //购置日期(文字)
                        barval= barval+"TEXT 200,230," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@2"  + enterkey;
                        //购置日期(内容)
                        barval= barval+"TEXT 330,230," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@3" + enterkey;
                    barval= barval+"BAR 50, 265, 650, 5" + enterkey;
                        //资产代码(文字)
                        barval= barval+"TEXT 60,280," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@4" + enterkey;
                        //资产代码(内容)
                        barval= barval+"TEXT 170,270," + quoteskey+"5" + quoteskey + ",0,1,1,@5" + enterkey;
                    barval= barval+"BAR 50, 320, 650, 5" + enterkey;
                        //设备型号(文字)
                        barval= barval+"TEXT 60,330," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@6" + enterkey;
                        //设备型号(内容)
                        barval= barval+"TEXT 170,330," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@7"  + enterkey;
                    barval= barval+"BAR 50, 370, 650, 5" + enterkey;
                        //品牌型号(文字)
                        barval= barval+"TEXT 60,380," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@8"  + enterkey;
                        //品牌型号(内容)
                        barval= barval+"TEXT 170,380," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@9"  + enterkey;
                    barval= barval+"BAR 50, 420, 650, 5" + enterkey;
                        //责任人(文字)
                        barval= barval+"TEXT 60,430," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@10"  + enterkey;
                        //责任人(内容)
                        barval= barval+"TEXT 170,430," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@11" + enterkey;
                    barval= barval+"BAR 50, 470, 650, 5" + enterkey;   
                        //部门(文字)
                        barval= barval+"TEXT 60,480," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@12"  + enterkey;
                        //部门(内容)
                        barval= barval+"TEXT 170,480," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@13" + enterkey;
                    barval= barval+"BAR 50, 520, 650, 5" + enterkey;
                        //单位(文字)
                        barval= barval+"TEXT 60,530," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@14" + enterkey;
                        //单位(内容)
                        barval= barval+"TEXT 170,530," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@15"  + enterkey;
                    barval= barval+"BAR 160, 265, 5, 300" + enterkey;
                    barval= barval+"BAR 50, 570, 650, 5" + enterkey;
                    //设备序号(文字)
                    barval= barval+"TEXT 60,580," + quoteskey+"TSS24.BF2" + quoteskey + ",0,1,1,@16"  + enterkey;
                   
                    //主机
                    var PrintComputer=barval+"BARCODE 80,630," + quoteskey+"39" + quoteskey + ",85,0,0,2,6,@17" + enterkey;
                    //显示器
                    var PrintDisplay=barval+"BARCODE 80,630," + quoteskey+"39" + quoteskey + ",85,0,0,1,8,@18" + enterkey;

                    var PrintComputerEnd="TEXT 80,720," + quoteskey+"5" + quoteskey + ",0,1,1,@17"  + enterkey;
                    var PrintDisplayEnd="TEXT 80,720," + quoteskey+"5" + quoteskey + ",0,1,1,@18"  + enterkey;
                   
                    var PrintEnd= "PRINT 1,1" + enterkey;
                    PrintEnd= PrintEnd + realkey + "Z" + enterkey;
                   
                    PrintComputer =PrintComputer + PrintComputerEnd + PrintEnd;
                    PrintDisplay= PrintDisplay + PrintDisplayEnd + PrintEnd;
                   
                     var fso1= new ActiveXObject("Scripting.FileSystemObject");
                    var objprinter1=fso1.CreateTextFile("LPT1:",true);
                    objprinter1.Writeline(PrintComputer);
                    objprinter1.Close();  
                   
                    var fso2= new ActiveXObject("Scripting.FileSystemObject");
                    var objprinter2=fso2.CreateTextFile("LPT1:",true);
                    objprinter2.Writeline(PrintDisplay); 
                    objprinter2.Close();
                                                     
        }
       
    </script>

原创粉丝点击