附件管理功能开发,采购入库单导出pdf增加备注字段,采购入库和销售出库的提交按钮名称修改为审核按钮
13 files modified
268 ■■■■ changed files
src/web/Application/Home/Common/FIdConst.class.php 10 ●●●●● patch | view | raw | blame | history
src/web/Application/Home/Controller/AttachmentController.class.php 50 ●●●● patch | view | raw | blame | history
src/web/Application/Home/Controller/PurchaseController.class.php 6 ●●●●● patch | view | raw | blame | history
src/web/Application/Home/Controller/SaleController.class.php 7 ●●●●● patch | view | raw | blame | history
src/web/Application/Home/DAO/AttachmentDAO.class.php 27 ●●●●● patch | view | raw | blame | history
src/web/Application/Home/DAO/PWBillDAO.class.php 3 ●●●● patch | view | raw | blame | history
src/web/Application/Home/Service/AttachmentService.class.php 40 ●●●●● patch | view | raw | blame | history
src/web/Application/Home/Service/PWBillService.class.php 3 ●●●● patch | view | raw | blame | history
src/web/Application/Home/View/Purchase/pwbillIndex.html 5 ●●●● patch | view | raw | blame | history
src/web/Application/Home/View/Sale/wsIndex.html 3 ●●●● patch | view | raw | blame | history
src/web/Public/Scripts/PSI/Attachment/AttachmentList.js 56 ●●●● patch | view | raw | blame | history
src/web/Public/Scripts/PSI/Purchase/PWMainForm.js 40 ●●●● patch | view | raw | blame | history
src/web/Public/Scripts/PSI/Sale/WSMainForm.js 18 ●●●● patch | view | raw | blame | history
src/web/Application/Home/Common/FIdConst.class.php
@@ -380,6 +380,11 @@
  const PURCHASE_WAREHOUSE_PRINT = "2001-07";
  /**
   * 采购入库 - 附件
   */
  const PURCHASE_WAREHOUSE_ATTACHMENT = "2001-08";
  /**
   * 库存账查询
   */
  const INVENTORY_QUERY = "2003";
@@ -435,6 +440,11 @@
  const WAREHOUSING_SALE_PRINT = "2002-07";
  /**
   * 销售出库 - 附件
   */
  const WAREHOUSING_SALE_ATTACHMENT = "2002-08";
  /**
   * 销售退货入库
   */
  const SALE_REJECTION = "2006";
src/web/Application/Home/Controller/AttachmentController.class.php
@@ -20,8 +20,7 @@
  public function attachmentList()
  {
    if (IS_POST) {
      $us = new UserService();
      if (!$us->hasPermission(FIdConst::ATTACHMENT)) {
      if (!$this->checkPermission()) {
        die("没有权限");
      }
@@ -38,8 +37,7 @@
  public function uploadFile()
  {
    if (IS_POST) {
      $us = new UserService();
      if (!$us->hasPermission(FIdConst::ATTACHMENT)) {
      if (!$this->checkPermission()) {
        $this->ajaxReturn($this->noPermission("上传附件"));
        return;
      }
@@ -94,15 +92,45 @@
        $as = new AttachmentService();
        $this->ajaxReturn($as->addUploadInfo($params));
        $this->ajaxReturn(
          array(
            "msg" => $uploadFileFullPath,
            "success" => false
          )
        );
      }
    }
  }
  /**
   * 删除附件
   */
  public function delete()
  {
    if (IS_POST) {
      if (!$this->checkPermission()) {
        $this->ajaxReturn($this->noPermission("删除附件"));
        return;
      }
      if(!I("post.attachmentId")){
        $this->ajaxReturn(
          array(
          "success" => false,
          "msg" => "请选择要删除的附件。"
        ));
        return;
      }
      $params["attachmentId"] = I("post.attachmentId");
      $as = new AttachmentService();
      $this->ajaxReturn($as->delete($params));
    }
  }
  private function checkPermission()
  {
    $us = new UserService();
    return $us->hasPermission(FIdConst::ATTACHMENT)
      || $us->hasPermission(FIdConst::PURCHASE_WAREHOUSE_ATTACHMENT)
      || $us->hasPermission(FIdConst::WAREHOUSING_SALE_ATTACHMENT);
  }
}
src/web/Application/Home/Controller/PurchaseController.class.php
@@ -71,6 +71,12 @@
        $us->hasPermission(FIdConst::PURCHASE_WAREHOUSE_PRINT) ? "1" : "0"
      );
      // 按钮权限:附件
      $this->assign(
        "pAttachment",
        $us->hasPermission(FIdConst::PURCHASE_WAREHOUSE_ATTACHMENT) ? "1" : "0"
      );
      $this->display();
    } else {
      $this->gotoLoginPage("/Home/Purchase/pwbillIndex");
src/web/Application/Home/Controller/SaleController.class.php
@@ -48,6 +48,13 @@
        "pCloseBill",
        $us->hasPermission(FIdConst::SALE_ORDER_CLOSE_BILL) ? "1" : "0"
      );
      // 按钮权限:附件
      $this->assign(
        "pAttachment",
        $us->hasPermission(FIdConst::WAREHOUSING_SALE_ATTACHMENT) ? "1" : "0"
      );
      $this->assign("showAddGoodsButton", $us->hasPermission(FIdConst::GOODS_ADD) ? "1" : "0");
      $this->display();
src/web/Application/Home/DAO/AttachmentDAO.class.php
@@ -99,4 +99,31 @@
    return null;
  }
  /**
   * 删除附件
   *
   * @param array $params
   * @return NULL|array
   */
  public function delete(&$params)
  {
    $db = $this->db;
    $id = trim($params["attachmentId"]);
    $companyId = $params["companyId"];
    if ($this->companyIdNotExists($companyId)) {
      return $this->badParam("companyId");
    }
    $sql = "update t_c_attachment set status = 1
            where id = %d ";
    $rc = $db->execute($sql, $id);
    if ($rc === false) {
      return $this->sqlError(__METHOD__, __LINE__);
    }
    // 操作成功
    return null;
  }
}
src/web/Application/Home/DAO/PWBillDAO.class.php
@@ -1890,7 +1890,7 @@
    $sql = "select p.id, p.bill_status, p.ref, p.biz_dt, u1.name as biz_user_name, u2.name as input_user_name,
              p.goods_money, w.name as warehouse_name, s.name as supplier_name,
              p.date_created, p.payment_type, p.company_id, p.money_with_tax
              p.date_created, p.payment_type, p.company_id, p.money_with_tax,p.bill_memo
            from t_pw_bill p, t_warehouse w, t_supplier s, t_user u1, t_user u2
            where (p.warehouse_id = w.id) and (p.supplier_id = s.id)
            and (p.biz_user_id = u1.id) and (p.input_user_id = u2.id) 
@@ -1918,6 +1918,7 @@
    $result["bizDT"] = $this->toYMD($v["biz_dt"]);
    $result["warehouseName"] = $v["warehouse_name"];
    $result["bizUserName"] = $v["biz_user_name"];
    $result["bill_memo"] = $v["bill_memo"];
    $sql = "select g.code, g.name, g.spec, u.name as unit_name, 
              convert(p.goods_count, $fmt) as goods_count, p.goods_price,
src/web/Application/Home/Service/AttachmentService.class.php
@@ -70,4 +70,44 @@
    return $this->ok(null);
  }
  /**
   * 删除附件
   *
   * @param array $params
   * @return NULL|array
   */
  public function delete($params)
  {
    if ($this->isNotOnline()) {
      return $this->notOnlineError();
    }
    $id = $params["attachmentId"];
    $db = $this->db();
    $db->startTrans();
    $dao = new AttachmentDAO($db);
    $log = null;
    $params["companyId"] = $this->getCompanyId();
    $rc = $dao->delete($params);
    if ($rc) {
      $db->rollback();
      return $rc;
    }
    $log = "删除附件: $id";
    // 记录业务日志
    $bs = new BizlogService($db);
    $bs->insertBizlog($log, $this->LOG_CATEGORY);
    $db->commit();
    return $this->ok(null);
  }
}
src/web/Application/Home/Service/PWBillService.class.php
@@ -301,7 +301,8 @@
                    <tr><td colspan="2">单号:' . $ref . '</td></tr>
                    <tr><td colspan="2">供应商:' . $bill["supplierName"] . '</td></tr>
                    <tr><td>业务日期:' . $bill["bizDT"] . '</td><td>入库仓库:' . $bill["warehouseName"] . '</td></tr>
                    <tr><td>业务员:' . $bill["bizUserName"] . '</td><td></td></tr>';
          <tr><td>业务员:' . $bill["bizUserName"] . '</td><td></td></tr>';
    $html .= '<tr><td colspan="2">备注:' . $bill["bill_memo"] . '</td></tr>';
    if ($canViewPrice) {
      $html .= '<tr><td>采购货款:' . $bill["goodsMoney"] . ' (' . $utilService->moneyToCap($bill["goodsMoney"]) . ')</td>' .
        '<td>价税合计:' . $bill["moneyWithTax"] . ' (' . $utilService->moneyToCap($bill["moneyWithTax"]) . ')</td></tr>';
src/web/Application/Home/View/Purchase/pwbillIndex.html
@@ -23,6 +23,8 @@
<script src="{$uri}Public/Lodop/LodopFuncs.js?dt={$dtFlag}" type="text/javascript"></script>
<script src="{$uri}Public/Scripts/PSI/Attachment/AttachmentList.js?dt={$dtFlag}" type="text/javascript"></script>
<script>
  Ext.onReady(function () {
    var app = Ext.create("PSI.App", {
@@ -38,7 +40,8 @@
      genPDF: "{$pGenPDF}",
      showAddGoodsButton: "{$showAddGoodsButton}",
      viewPrice: "{$pViewPrice}",
      print: "{$pPrint}"
      print: "{$pPrint}",
      attachment:"{$pAttachment}"
    };
    app.add(Ext.create("PSI.Purchase.PWMainForm", {
      permission: permission
src/web/Application/Home/View/Sale/wsIndex.html
@@ -35,7 +35,8 @@
      del: "{$pDelete}",
      commit: "{$pCommit}",
      genPDF: "{$pGenPDF}",
      print: "{$pPrint}"
      print: "{$pPrint}",
      attachment:"{$pAttachment}"
    };
    app.add(Ext.create("PSI.Sale.WSMainForm", {
src/web/Public/Scripts/PSI/Attachment/AttachmentList.js
@@ -36,10 +36,6 @@
        title: me.formatGridHeaderTitle("附件")
      },
      padding: 5,
      selModel: {
        mode: "MULTI"
      },
      selType: "checkboxmodel",
      viewConfig: {
        deferEmptyText: false,
        emptyText: ""
@@ -49,7 +45,7 @@
      columns: [{
        header: "附件名",
        dataIndex: "fileName",
        width: 300,
        width: 400,
        menuDisabled: true,
        renderer: function (value, md, record) {
          return "<a href='"
@@ -67,18 +63,23 @@
        dataIndex: "createOn",
        width: 170,
        menuDisabled: true
      },{
      }, {
        header: "操作",
        dataIndex: "fullName",
        width: 110,
        align: "center",
        menuDisabled: true,
        sortable: false,
        renderer: function (value, md, record) {
          return "<a href='"
            + PSI.Const.BASE_URL
            + record.get("fullName")
            + "' target='_blank'>下载</a>";
        }
        width: 50,
        xtype: "actioncolumn",
        items: [{
          icon: PSI.Const.BASE_URL
            + "Public/Images/icons/delete.png",
          handler: function (grid, row) {
            PSI.MsgBox.confirm("请确认是否要删除此附件", function () {
              var store = grid.getStore();
              me.onDelete(store.getAt(row).get("id"));
            });
          },
          scope: this
        }]
      }]
    });
@@ -248,5 +249,30 @@
        PSI.MsgBox.showInfo(action.result.msg);
      }
    });
  },
  onDelete: function (id) {
    var me = this;
    Ext.Ajax.request({
      url: PSI.Const.BASE_URL
        + "Home/Attachment/delete",
      params: {
        attachmentId:id
      },
      method: "POST",
      callback: function (options, success, response) {
        if (success) {
          var data = Ext.JSON.decode(response.responseText);
          if(data.success){
            PSI.MsgBox.showInfo("删除成功");
            me.onWndShow();
          }else{
            PSI.MsgBox.showInfo("删除失败");
          }
        }else{
          PSI.MsgBox.showInfo("删除失败");
        }
      }
    });
  }
});
src/web/Public/Scripts/PSI/Purchase/PWMainForm.js
@@ -82,11 +82,17 @@
      hidden: me.getPermission().del == "0",
      xtype: "tbseparator"
    }, {
      text: "提交入库",
      text: "审核",
      hidden: me.getPermission().commit == "0",
      scope: me,
      handler: me.onCommit,
      id: "buttonCommit"
    }, {
      text: "附件",
      hidden: me.getPermission().attachment == "0",
      id: "buttonAttachment",
      scope: me,
      handler: me.onAttachment
    }, {
      hidden: me.getPermission().commit == "0",
      xtype: "tbseparator"
@@ -669,7 +675,7 @@
    var bill = item[0];
    if (bill.get("billStatus") == "已入库") {
      me.showInfo("当前采购入库单已经提交入库,不能删除");
      me.showInfo("当前采购入库单已经审核入库,不能删除");
      return;
    }
@@ -788,34 +794,34 @@
  },
    /**
     * 提交采购入库单
     * 审核采购入库单
     */
  onCommit: function () {
    var me = this;
    var item = me.getMainGrid().getSelectionModel().getSelection();
    if (item == null || item.length != 1) {
      me.showInfo("没有选择要提交的采购入库单");
      me.showInfo("没有选择要审核的采购入库单");
      return;
    }
    var bill = item[0];
    if (bill.get("billStatus") == "已入库") {
      me.showInfo("当前采购入库单已经提交入库,不能再次提交");
      me.showInfo("当前采购入库单已经审核入库,不能再次审核");
      return;
    }
    var detailCount = me.getDetailGrid().getStore().getCount();
    if (detailCount == 0) {
      me.showInfo("当前采购入库单没有录入商品明细,不能提交");
      me.showInfo("当前采购入库单没有录入商品明细,不能审核");
      return;
    }
    var info = "请确认是否提交单号: <span style='color:red'>" + bill.get("ref")
    var info = "请确认是否审核单号: <span style='color:red'>" + bill.get("ref")
      + "</span> 的采购入库单?";
    var id = bill.get("id");
    var confirmFunc = function () {
      var el = Ext.getBody();
      el.mask("正在提交中...");
      el.mask("正在审核中...");
      var r = {
        url: me.URL("Home/Purchase/commitPWBill"),
        params: {
@@ -827,7 +833,7 @@
          if (success) {
            var data = me.decodeJSON(response.responseText);
            if (data.success) {
              me.showInfo("成功完成提交操作", function () {
              me.showInfo("成功完成审核操作", function () {
                me.refreshMainGrid(id);
              });
            } else {
@@ -843,6 +849,22 @@
    me.confirm(info, confirmFunc);
  },
  onAttachment: function () {
    var item = this.getMainGrid().getSelectionModel().getSelection();
    if (item == null || item.length != 1) {
      PSI.MsgBox.showInfo("请选择一条入库单");
      return;
    }
    var bill = item[0];
    var form = Ext.create("PSI.Attachment.AttachmentList", {
      parentForm: this,
      linkTableName: "t_pw_bill",
      linkDataId:bill.get("id")
    });
    form.show();
  },
  gotoMainGridRecord: function (id) {
    var me = this;
    var grid = me.getMainGrid();
src/web/Public/Scripts/PSI/Sale/WSMainForm.js
@@ -84,14 +84,14 @@
      hidden: me.getPermission().del == "0",
      xtype: "tbseparator"
    }, {
      text: "提交出库",
      text: "审核",
      hidden: me.getPermission().commit == "0",
      id: "buttonCommit",
      scope: me,
      handler: me.onCommit
    }, {
      text: "附件",
      // hidden: me.getPermission().commit == "0",
      hidden: me.getPermission().attachment == "0",
      id: "buttonAttachment",
      scope: me,
      handler: me.onAttachment
@@ -662,7 +662,7 @@
    var bill = item[0];
    if (bill.get("billStatus") == "已出库") {
      PSI.MsgBox.showInfo("当前销售出库单已经提交出库,不能删除");
      PSI.MsgBox.showInfo("当前销售出库单已经审核出库,不能删除");
      return;
    }
@@ -809,27 +809,27 @@
    var me = this;
    var item = me.getMainGrid().getSelectionModel().getSelection();
    if (item == null || item.length != 1) {
      PSI.MsgBox.showInfo("没有选择要提交的销售出库单");
      PSI.MsgBox.showInfo("没有选择要审核的销售出库单");
      return;
    }
    var bill = item[0];
    if (bill.get("billStatus") == "已出库") {
      PSI.MsgBox.showInfo("当前销售出库单已经提交出库,不能再次提交");
      PSI.MsgBox.showInfo("当前销售出库单已经审核出库,不能再次审核");
      return;
    }
    var detailCount = me.getDetailGrid().getStore().getCount();
    if (detailCount == 0) {
      PSI.MsgBox.showInfo("当前销售出库单没有录入商品明细,不能提交");
      PSI.MsgBox.showInfo("当前销售出库单没有录入商品明细,不能审核");
      return;
    }
    var info = "请确认是否提交单号: <span style='color:red'>" + bill.get("ref")
    var info = "请确认是否审核单号: <span style='color:red'>" + bill.get("ref")
      + "</span> 的销售出库单?";
    PSI.MsgBox.confirm(info, function () {
      var el = Ext.getBody();
      el.mask("正在提交中...");
      el.mask("正在审核中...");
      Ext.Ajax.request({
        url: PSI.Const.BASE_URL
          + "Home/Sale/commitWSBill",
@@ -844,7 +844,7 @@
            var data = Ext.JSON
              .decode(response.responseText);
            if (data.success) {
              PSI.MsgBox.showInfo("成功完成提交操作",
              PSI.MsgBox.showInfo("成功完成审核操作",
                function () {
                  me
                    .refreshMainGrid(data.id);