附件管理功能开发,采购入库单导出pdf增加备注字段,采购入库和销售出库的提交按钮名称修改为审核按钮
| | |
| | | const PURCHASE_WAREHOUSE_PRINT = "2001-07"; |
| | | |
| | | /** |
| | | * 采购入库 - 附件 |
| | | */ |
| | | const PURCHASE_WAREHOUSE_ATTACHMENT = "2001-08"; |
| | | |
| | | /** |
| | | * 库存账查询 |
| | | */ |
| | | const INVENTORY_QUERY = "2003"; |
| | |
| | | const WAREHOUSING_SALE_PRINT = "2002-07"; |
| | | |
| | | /** |
| | | * 销售出库 - 附件 |
| | | */ |
| | | const WAREHOUSING_SALE_ATTACHMENT = "2002-08"; |
| | | |
| | | /** |
| | | * 销售退货入库 |
| | | */ |
| | | const SALE_REJECTION = "2006"; |
| | |
| | | public function attachmentList() |
| | | { |
| | | if (IS_POST) { |
| | | $us = new UserService(); |
| | | if (!$us->hasPermission(FIdConst::ATTACHMENT)) { |
| | | if (!$this->checkPermission()) { |
| | | die("没有权限"); |
| | | } |
| | | |
| | |
| | | public function uploadFile() |
| | | { |
| | | if (IS_POST) { |
| | | $us = new UserService(); |
| | | if (!$us->hasPermission(FIdConst::ATTACHMENT)) { |
| | | if (!$this->checkPermission()) { |
| | | $this->ajaxReturn($this->noPermission("上传附件")); |
| | | return; |
| | | } |
| | |
| | | |
| | | $as = new AttachmentService(); |
| | | $this->ajaxReturn($as->addUploadInfo($params)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除附件 |
| | | */ |
| | | public function delete() |
| | | { |
| | | if (IS_POST) { |
| | | if (!$this->checkPermission()) { |
| | | $this->ajaxReturn($this->noPermission("删除附件")); |
| | | return; |
| | | } |
| | | |
| | | if(!I("post.attachmentId")){ |
| | | $this->ajaxReturn( |
| | | array( |
| | | "msg" => $uploadFileFullPath, |
| | | "success" => false |
| | | ) |
| | | ); |
| | | "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); |
| | | } |
| | | |
| | | } |
| | |
| | | $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"); |
| | |
| | | "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(); |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | |
| | | $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) |
| | |
| | | $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, |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | <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>'; |
| | | $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>'; |
| | |
| | | |
| | | <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", { |
| | |
| | | genPDF: "{$pGenPDF}", |
| | | showAddGoodsButton: "{$showAddGoodsButton}", |
| | | viewPrice: "{$pViewPrice}", |
| | | print: "{$pPrint}" |
| | | print: "{$pPrint}", |
| | | attachment:"{$pAttachment}" |
| | | }; |
| | | app.add(Ext.create("PSI.Purchase.PWMainForm", { |
| | | permission: permission |
| | |
| | | del: "{$pDelete}", |
| | | commit: "{$pCommit}", |
| | | genPDF: "{$pGenPDF}", |
| | | print: "{$pPrint}" |
| | | print: "{$pPrint}", |
| | | attachment:"{$pAttachment}" |
| | | }; |
| | | |
| | | app.add(Ext.create("PSI.Sale.WSMainForm", { |
| | |
| | | title: me.formatGridHeaderTitle("附件") |
| | | }, |
| | | padding: 5, |
| | | selModel: { |
| | | mode: "MULTI" |
| | | }, |
| | | selType: "checkboxmodel", |
| | | viewConfig: { |
| | | deferEmptyText: false, |
| | | emptyText: "" |
| | |
| | | columns: [{ |
| | | header: "附件名", |
| | | dataIndex: "fileName", |
| | | width: 300, |
| | | width: 400, |
| | | menuDisabled: true, |
| | | renderer: function (value, md, record) { |
| | | return "<a href='" |
| | |
| | | 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 |
| | | }] |
| | | }] |
| | | }); |
| | | |
| | |
| | | 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("删除失败"); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | |
| | | 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" |
| | |
| | | var bill = item[0]; |
| | | |
| | | if (bill.get("billStatus") == "已入库") { |
| | | me.showInfo("当前采购入库单已经提交入库,不能删除"); |
| | | me.showInfo("当前采购入库单已经审核入库,不能删除"); |
| | | return; |
| | | } |
| | | |
| | |
| | | }, |
| | | |
| | | /** |
| | | * 提交采购入库单 |
| | | * 审核采购入库单 |
| | | */ |
| | | 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: { |
| | |
| | | if (success) { |
| | | var data = me.decodeJSON(response.responseText); |
| | | if (data.success) { |
| | | me.showInfo("成功完成提交操作", function () { |
| | | me.showInfo("成功完成审核操作", function () { |
| | | me.refreshMainGrid(id); |
| | | }); |
| | | } else { |
| | |
| | | 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(); |
| | |
| | | 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 |
| | |
| | | var bill = item[0]; |
| | | |
| | | if (bill.get("billStatus") == "已出库") { |
| | | PSI.MsgBox.showInfo("当前销售出库单已经提交出库,不能删除"); |
| | | PSI.MsgBox.showInfo("当前销售出库单已经审核出库,不能删除"); |
| | | return; |
| | | } |
| | | |
| | |
| | | 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", |
| | |
| | | var data = Ext.JSON |
| | | .decode(response.responseText); |
| | | if (data.success) { |
| | | PSI.MsgBox.showInfo("成功完成提交操作", |
| | | PSI.MsgBox.showInfo("成功完成审核操作", |
| | | function () { |
| | | me |
| | | .refreshMainGrid(data.id); |