Browse Source

打印委托单

15168162575 2 years ago
parent
commit
caedd625e1

+ 81 - 2
application/admin/controller/Entrust.php

@@ -490,11 +490,90 @@ class Entrust extends Backend
         }
         $this->success('确认成功');
     }
-    //委托单
-    public function commissionSheet(){
+    //委托单页面
+    public function commissionsheet(){
+        //获取样品名称
+        $id = input('id');
+        if (empty($id)){
+            $this->error('参数错误');
+        }
+        $this->assign('name',Db::name('entrust')->where('id',$id)->find());
+        //委托单上传
 
         return $this->view->fetch();
     }
+    //委托单上传
+    public function commissionsheetup(){
+        $params = [];
+        if (true === $this->request->isPost()){
+            $params['entrust_user'] = input('entrust_user');
+            $params['entrust_time'] = input('entrust_time');
+            $params['entrust_id'] = input('entrust_id');
+            $params['name'] = input('name');
+            $params['status'] = input('status');
+            $params['num'] = input('num');
+            $params['project'] = input('project');
+            $params['no'] = input('no');
+            $params['requirement'] = input('requirement');
+            $params['reportnumber'] = input('reportnumber');
+            $params['deal'] = input('deal');
+            $params['condition'] = input('condition');
+            $params['isue'] = input('isue');
+            $params['testcost'] = input('testcost');
+            $params['standard'] = input('standard');
+        }
+        $judgment = Db::name('entrust_print')->where('entrust_user',$params['entrust_user'])
+            ->where('entrust_id',$params['entrust_id'])
+            ->where('name',$params['name'])
+            ->where('no',$params['no'])->find();
+        if (empty($judgment)){
+            $res = Db::name('entrust_print')->insert($params);
+            if (!empty($res)){
+                $this->success();
+            }
+        }else{
+            $this->error();
+        }
+    }
+    //委托单批量打印
+    public function printing(){
+        $datas=$res =$row = array();
+        if ($this->request->isGet()){
+            $ids  =explode(',',$this->request->get('ids')) ;
+            for($i=0;$i<count($ids);$i++){
+                $datas[$i] = Db::name('entrust')->where('id',$ids[$i])->find();
+            }
+            for ($i=0;$i<count($datas);$i++){
+                $row[$i] = Db::name('entrust_print')->where('entrust_id',$datas[$i]['no'])
+                    ->where('name',$datas[$i]['name'])
+                    ->where('no',$datas[$i]['sample_no'])->find();
+                if (!empty($row)){
+                    $res['entrust_user'][$i]=$row[$i]['entrust_user'];
+                    $res['entrust_id'][$i]=$row[$i]['entrust_id'];
+                    $res['set'][$i]['name'] = $row[$i]['name'];
+                    $res['set'][$i]['status'] = $row[$i]['status'];
+                    $res['set'][$i]['num'] = $row[$i]['num'];
+                    $res['set'][$i]['project'] = $row[$i]['project'];
+                    $res['set'][$i]['no'] = $row[$i]['no'];
+                }else{
+                    return $this->error('序号'.$i++.'委托单未提交');
+                }
+            }
+            $res['entrust_time'] = $row['0']['entrust_time'];
+            $res['requirement'] = $row['0']['requirement'];
+            $res['reportnumber'] = $row['0']['reportnumber'];
+            $res['deal'] = $row['0']['deal'];
+            $res['condition'] = $row['0']['condition'];
+            $res['isue'] = $row['0']['isue'];
+            $res['testcost'] = $row['0']['testcost'];
+            $res['standard'] = $row['0']['standard'];
+            $res['entrust_user'] = implode('、',array_unique($res['entrust_user']));
+            $res['entrust_id'] = implode('、',array_unique($res['entrust_id']));
+            $this->view->assign('row',$res);
+        }
+        return $this->view->fetch();
+
+    }
     //生成委托单号
     public function getNo(){
         $params = input('temp');

+ 1 - 1
application/admin/view/entrust/index.html

@@ -20,7 +20,7 @@
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('entrust/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('entrust/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('entrust/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-
+                        <a href="javascript:;" class="btn btn-success btn-printing btn-disabled disabled {:$auth->check('entrust/print')?'':'hide'}" title="打印" ><i class="fa fa-pencil"></i>打印</a>
 
 <!--                        <div class="dropdown btn-group {:$auth->check('entrust/multi')?'':'hide'}">-->
 <!--                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->

+ 226 - 10
application/admin/view/entrust/printing.html

@@ -1,10 +1,226 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-  <meta charset="UTF-8">
-  <title>$Title$</title>
-</head>
-<body>
-$END$
-</body>
-</html>
+
+<style type="text/css">
+    .table{table-layout: fixed;}
+    .table tbody tr td{font-size: 13px;padding-top: 0;padding-bottom: 0;vertical-align: middle;}
+    input{padding-top: 0;padding-bottom: 0;}
+    label{font-weight: inherit;}
+    .radio{padding-top: 0;min-height: auto;margin: 0;}
+    input[type="checkbox"]{padding-top: 0;}
+    #ee{text-align: center;}
+</style>
+    <div class="container" style="width: 210mm;height: 297mm;" >
+        <table id="tableprint" class="table table-bordered">
+            <caption style="font-weight: normal;font-size: 20px; text-align: center;color: #0d0d0d;" >检测委托书</caption>
+            <thead>
+            </thead>
+            <tbody>
+            <tr >
+                <td colspan="2" style="padding: 0;"><label >委托编号:</label></td>
+                <td colspan="12" style="padding: 0;">
+                    <input id="c-entrust_id" style="border: none;" class="form-control" data-rule="required" name="entrust_id" type="text" value="{$row['entrust_id']}" >
+                </td>
+            </tr>
+            <tr >
+                <td colspan="2" id="ee" style="padding: 0;"><label>委托方</label></td>
+                <td colspan="8" style="padding: 0; v">
+                    <input id="c-entrust_user" class="form-control" data-rule="required"  style="background-color: #FFFFFF;border: none;" name="entrust_user" type="text" value="{$row['entrust_user']}">
+                </td>
+                <td colspan="2" id="ee" style="padding: 0; "><label>委托日期</label></td>
+                <td colspan="2" style="padding: 0; ">
+                    <input id="c-entrust_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" style="background-color: #FFFFFF;border: none;" data-use-current="true" name="entrust_time" type="text" value="{$row['entrust_time']}">
+                </td>
+            </tr>
+            <tr>
+                <td colspan="14" id="ee"><h3 align="center">委托样品信息</h3></td>
+            </tr>
+            <tr>
+                <td colspan="6" id="ee"><label >样品名称、规格、生产证号</label></td>
+                <td colspan="2" id="ee"><label >样品状态</label></td>
+                <td id="ee"><label >样品数量</label></td>
+                <td colspan="2" id="ee"><label >委托检测项目</label></td>
+                <td colspan="3" id="ee"><label >样品编号</label></td>
+            </tr>
+            {volist name="row['set']" id="vo"}
+            <tr>
+                <td colspan="6">
+                    <input id="c-name" class="form-control" style="background-color: #FFFFFF;border: none;" name="name" data-rule="required" type="text" value="{$vo.name}">
+                </td>
+                <td colspan="2">
+                    <div class="radio" >
+                        <label><input name="status"  type="checkbox" value="1" {if $vo.status == 1}checked{/if}>密&nbsp;&nbsp;&nbsp;&nbsp;封</label><br>
+                    </div>
+                    <div class="radio">
+                        <label><input name="status" type="checkbox"  value="2" {if $vo.status == 2}checked{/if}>不密封</label>
+                    </div>
+                </td>
+                <td >
+                    <input id="c-num" class="form-control" style="background-color: #FFFFFF;border: none;" data-rule="required" name="num" value="{$vo.num}" >
+                </td>
+                <td colspan="2">
+                    <input id="c-project" class="form-control"  style="background-color: #FFFFFF;border: none;" name="project" type="text" value="{$vo.project}">
+                </td>
+                <td colspan="3">
+                    <input id="c-no" class="form-control" style="background-color: #FFFFFF;border: none;" data-rule="required" name="no"  type="text" value="{$vo.no}">
+                </td>
+            </tr>
+            {/volist}
+            <tr>
+                <td colspan="2" id="ee"><label>备注</label></td>
+                <td colspan="7">
+                    <div class="form-inline">
+                        <div class="radio">
+                            <label class="checkbox-inline"><input  name="requirement" type="radio" {if $row['requirement'] == 1}checked{/if} value="1">正式报告</label>
+                            <label class="checkbox-inline"><input  name="requirement" type="radio" {if $row['requirement'] == 2}checked{/if} value="2">简化报告</label>
+                            <label class="checkbox-inline"><input  name="requirement" type="radio" {if $row['requirement'] == 3}checked{/if} value="3">检测数据</label>
+                        </div>
+                    </div>
+                </td>
+                <td colspan="2" id="ee"><label>报告份数</label></td>
+                <td colspan="3">
+                    <input id="c-reportnumber" class="form-control " style="background-color: #FFFFFF;border: none;" name="reportnumber" type="text" value="{$row['reportnumber']}" >
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" id="ee"><label>检后样品处理要求</label></td>
+                <td colspan="5">
+                    <div class="form-inline">
+                        <div class="radio" >
+                            <label><input name="deal" type="radio" {if $row['deal'] == 1}checked{/if} value="1">&nbsp;&nbsp;委托方取回</label>
+                            <label><input name="deal" type="radio" {if $row['deal'] == 2}checked{/if} value="2">&nbsp;&nbsp;本中心处理</label>
+                        </div>
+                    </div>
+                </td>
+                <td colspan="2" id="ee"><label>样品保存条件</label></td>
+                <td colspan="5">
+                    <div class="form-inline">
+                        <div class="radio" >
+                            <label><input name="condition" type="radio" {if $row['condition'] == 1}checked{/if} value="1">&nbsp;&nbsp;密封</label>
+                            <label><input name="condition" type="radio" {if $row['condition'] == 2}checked{/if} value="2">&nbsp;&nbsp;其他</label>
+                        </div>
+                    </div>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" id="ee"><label>报告发放</label></td>
+                <td colspan="7">
+                    <div class="form-inline">
+                        <div class="radio">
+                            <label><input name="isue" type="radio" {if $row['isue'] == 1}checked{/if} value="1">&nbsp;&nbsp;自取</label>
+
+                            <label><input name="isue" type="radio" {if $row['isue'] == 2}checked{/if} value="2">&nbsp;&nbsp;邮寄</label>
+
+                            <label><input name="isue" type="radio" {if $row['isue'] == 3}checked{/if} value="3">&nbsp;&nbsp;传真</label>
+
+                            <label><input name="isue" type="radio" {if $row['isue'] == 4}checked{/if} value="4">&nbsp;&nbsp;邮箱</label>
+                        </div>
+                    </div>
+                </td>
+                <td colspan="2" id="ee"><label>检测费用</label></td>
+                <td colspan="3">
+                    <input id="c-testcost" class="form-control" step="1" style="background-color: #FFFFFF;border: none;" name="testcost" type="number" value="{$row['testcost']}">
+                </td>
+            </tr>
+            <tr>
+                <td rowspan="2" colspan="2" id="ee"><label>委托协议</label></td>
+                <td colspan="3" id="ee"><label>1.检测依据标准</label></td>
+                <td colspan="9">
+                    <div class="form-inline">
+                        <div class="radio">
+                            <label><input name="standard" type="radio" {if $row['standard'] == 1}checked{/if} value="1">&nbsp;&nbsp;YC/T 207-2014</label>
+
+                            <label><input name="standard" type="radio" {if $row['standard'] == 2}checked{/if} value="2">&nbsp;&nbsp;YQ/T 35-2013</label>
+
+                            <label><input name="standard" type="radio" {if $row['standard'] == 3}checked{/if} value="3">&nbsp;&nbsp;GB/T 7974-2013</label>
+
+                            <label><input name="standard" type="radio" {if $row['standard'] == 4}checked{/if} value="4">&nbsp;&nbsp;GB/T 18348-2008</label>
+
+                            <label><input name="standard" type="radio" {if $row['standard'] == 5}checked{/if} value="5" >&nbsp;&nbsp;其他</label>
+                        </div>
+                    </div>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="12">
+                    <p>2.一般情况下自收样起7个工作日内出检验报告,如有变动以书面或电话通知委托方。如需加急应先与做样科室协商,
+                        加急费按样品收费标准的20%收取。美浓集团内部送样检测不收费用。委托方收到检测报告后有疑义请在5个工作日
+                        内反馈,反馈电话0571-88308050(检测室)。
+                    </p>
+                    <p>
+                        3.报告数量说明:若无特殊说明,承检方提供委托方报告正本一份。如对检测报告有特殊要求,应在“备注”中说明。
+                    </p>
+                    <p>
+                        4.委托检测只对来样负责,报告结果不得用于商业宣传。承检方承诺对委托方的所有商业或技术保密。
+                    </p>
+                    <p>
+                        5.如有需要,委托方是否同意对样品进行分包检验:       分包方:
+                    </p>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="7">
+                    <div class="from-grop">
+                        <textarea class="form-control" rows="4" style="background-color: #FFFFFF;border: none;resize: none;" disabled>委托方(签章):</textarea>
+                    </div>
+                </td>
+                <td colspan="7">
+                    <div class="from-grop">
+                        <textarea class="form-control" rows="4" style="background-color: #FFFFFF;border: none;resize: none;"   disabled>承检方(签章):</textarea>
+                    </div>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" id="ee"><label>委托方信息</label></td>
+                <td colspan="5">
+                    <div class="from-grop">
+                        <textarea class="form-control" rows="6" style="background-color: #FFFFFF;border: none;overflow: hidden;resize: none;"  disabled>
+地址:
+电话:
+账户名称:
+开户银行:
+账户:
+传真:
+                        </textarea>
+                    </div>
+                </td>
+                <td colspan="2" id="ee"><label>承检方信息</label></td>
+                <td colspan="5">
+                    <p>地址:杭州市临平区余杭经济开发区康达路508号</p>
+                    <p>电话:0571-89358845&nbsp;&nbsp;&nbsp;&nbsp;传真:0571-88308017</p>
+                    <p>账户名称:浙江美浓世纪集团有限公司</p>
+                    <p>开户银行:工行杭州市高新支行</p>
+                    <p>账户:1202026209900052341</p>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" id="ee"><label>样品流转信息</label></td>
+                <td colspan="3" style="text-align: left;">
+                    <div class="from-grop">
+                        <textarea class="form-control" rows="3" style="background-color: #FFFFFF;border: none;resize: none;"  disabled>检测收样人:
+                        </textarea>
+                    </div>
+                </td>
+                <td colspan="3" style="text-align: left;">
+                    <div class="from-grop">
+                        <textarea class="form-control" rows="3" style="background-color: #FFFFFF;border: none;resize: none;"  disabled>检完退样___张退样人:
+                        </textarea>
+                    </div>
+                </td>
+                <td colspan="3" style="text-align: left;">
+                    <div class="from-grop">
+                        <textarea class="form-control" rows="3" style="background-color: #FFFFFF;border: none;resize: none;"  disabled>退样接收人:
+                        </textarea>
+                    </div>
+                </td>
+                <td colspan="3" style="text-align: left;">
+                    <div class="from-grop">
+                        <textarea  rows="3" class="form-control" style="background-color: #FFFFFF;border: none;resize: none;"  disabled>退样留样15天后销毁销毁人:
+                        </textarea>
+                    </div>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+
+
+

+ 91 - 1
public/assets/js/backend/entrust.js

@@ -11,6 +11,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     del_url: 'entrust/del',
                     multi_url: 'entrust/multi',
                     import_url: 'entrust/import',
+                    printing_url: 'entrust/printing',
                     table: 'entrust',
                 }
             });
@@ -263,7 +264,96 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             })
             Controller.api.bindevent();
         },
-        commissionSheet:function () {
+        commissionsheet:function () {
+            Controller.api.bindevent();
+            Form.api.bindevent($("form[role=form]"), function (data, ret) {
+                Toastr.success("成功");
+            }, function (data, ret) {
+                Toastr.success("失败");
+            }, function (success, error) {
+                // 判断委托编号是否为空
+                var entrust_id = $('#c-entrust_id').val();
+                if (entrust_id == '' || entrust_id == undefined) {
+                    layer.confirm('委托编号不能为空');
+                    return false;
+                }
+                // 判断委托方是否为空
+                var entrust_user = $('#c-entrust_user').val();
+                if (entrust_user == '' || entrust_user == undefined) {
+                    layer.confirm('委托方不能为空');
+                    return false;
+                }
+                // 判断委托日期是否为空
+                var entrust_time = $('#c-entrust_time').val();
+                if (entrust_time == '' || entrust_time == undefined) {
+                    layer.confirm('委托日期不能为空');
+                    return false;
+                }
+                // 判断样品名称是否为空
+                var name = $('#c-name').val();
+                if (name == '' || name == undefined) {
+                    layer.confirm('样品名称不能为空');
+                    return false;
+                }
+                // 判断样品数量是否为空
+                var num = $('#c-num').val();
+                if (num == '' || num == undefined) {
+                    layer.confirm('样品数量不能为空');
+                    return false;
+                }
+                // 判断检测项目是否为空
+                var project = $('#c-project').val();
+                if (project == '' || project == undefined) {
+                    layer.confirm('检测项目不能为空');
+                    return false;
+                }
+                // 判断样品编号是否为空
+                var no = $('#c-no').val();
+                if (no == '' || no == undefined) {
+                    layer.confirm('样品编号不能为空');
+                    return false;
+                }
+                Fast.api.ajax({
+                    url: 'entrust/commissionsheetup',
+                    data: {
+                        entrust_user:entrust_user,
+                        entrust_time:entrust_time,
+                        entrust_id:entrust_id,
+                        name:name,
+                        num:num,
+                        project:project,
+                        no:no,
+                        status:$("input[name='status']:checked").val(),
+                        requirement:$("input[name='requirement']:checked").val(),
+                        reportnumber:$('#c-reportnumber').val(),
+                        deal:$("input[name='deal']:checked").val(),
+                        condition:$("input[name='condition']:checked").val(),
+                        isue:$("input[name='isue']:checked").val(),
+                        testcost:$('#c-testcost').val(),
+                        standard:$("input[name='standard']:checked").val()
+                    },
+                }, function (data, ret) {
+                    if (ret.code === 1){
+                        window.print();
+                    }
+                    parent.Toastr.success('添加成功');
+                    Fast.api.close();
+                    parent.Fast.api.refreshmenu();
+                    return false;
+                }, function (data, ret) {
+                    parent.Toastr.error('添加失败');
+                    Fast.api.close();
+                    parent.Fast.api.refreshmenu();
+                    return false;
+                });
+                return false;
+            });
+        },
+        printing: function (){
+            $(document).ready(function (){
+                Fast.api.close();
+                window.print();
+            });
             Controller.api.bindevent();
         },
         api: {

+ 12 - 0
public/assets/js/require-table.js

@@ -82,6 +82,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
             restoreallbtn: '.btn-restoreall',
             destroyallbtn: '.btn-destroyall',
             dragsortfield: 'weigh',
+            printingbtn: '.btn-printing',
         },
         button: {
             edit: {
@@ -351,6 +352,17 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                         Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
                     });
                 });
+                // 批量打印按钮事件
+                toolbar.on('click', Table.config.printingbtn, function () {
+                    var ids = Table.api.selectedids(table);
+                    if (ids.length > 5) {
+                        layer.confirm('最多选中五个');
+                        return;
+                    }
+                    var data = ids.toString();
+                    var url = options.extend.printing_url+'?ids='+data;
+                    Fast.api.open(url,'批量打印',);
+                });
                 //清空回收站
                 $(document).on('click', Table.config.destroyallbtn, function () {
                     var that = this;