????

Your IP : 18.217.0.242


Current Path : C:/inetpub/vhost/lantha.gdtsolutions.vn/wwwtest/wwwroot/static/js/
Upload File :
Current File : C:/inetpub/vhost/lantha.gdtsolutions.vn/wwwtest/wwwroot/static/js/4311.252ac2ff.chunk.js

(self.webpackChunkgdt=self.webpackChunkgdt||[]).push([[4311,8175],{8434:(a,e,t)=>{"use strict";t.d(e,{M:()=>n});const n={KH:"khachhang",NCC:"nhacungcap"}},18503:(a,e,t)=>{"use strict";t.d(e,{I:()=>n});const n={KinhDoanh:"kinhdoanh",GiaoHang:"giaohang"}},23237:()=>{},31815:()=>{},46220:(a,e,t)=>{"use strict";t.r(e),t.d(e,{default:()=>k});var n=t(9950),o=t(28412),i=t(30616),h=t(23931),s=t(44414);class r extends n.Component{render(){const{children:a}=this.props;return(0,s.jsx)(h.A,{md:"9",children:a})}}t(51487);var l=t(62181),d=t(18383),u=t(3447),g=t(18849),c=t(76115),p=t(4370),C=t(73613),M=t(67116);class B extends n.Component{constructor(a){super(a),this.downloadExcel=()=>{const{url_pdf:a,title:e}=this.props;(0,p.RN)(`${a}&mode=download_excel`,`${e}.xlsx`,"GET",null,!0).catch((a=>(0,M.a3)(a)))},this.toogleBtnExcel=()=>{this.setState({showBtn:!1})},this.loaderPDF=()=>{this.setState({showBtn:!0})},this.state={showBtn:!1}}render(){const{url_pdf:a,defaultScale:e}=this.props,{showBtn:t}=this.state;return(0,s.jsx)("div",{className:"report-viewer-pdf",children:a?(0,s.jsxs)(s.Fragment,{children:[t&&(0,s.jsx)(g.A,{onClick:this.downloadExcel,children:(0,s.jsx)(C.A,{fa:"file-excel-o"})}),(0,s.jsx)(u.Worker,{workerUrl:"pdf.worker.min.js",children:(0,s.jsx)(u.default,{renderError:a=>(0,s.jsx)("div",{className:"text-center",children:(0,s.jsx)(c.A,{color:"warning",children:"\u0110ang t\u1ea3i b\xe1o c\xe1o..."})}),onDocumentLoad:a=>this.loaderPDF(a.doc),defaultScale:1,fileUrl:`${p.Eh}/${a}&mode=blob`})})]}):(0,s.jsx)("div",{className:"alert alert-warning",children:"Kh\xf4ng hi\u1ec3n th\u1ecb b\xe1o c\xe1o"})})}}var y=t(53744),m=t(4272),D=t(49125),S=t(18503),N=t(8434);class k extends n.Component{constructor(a){super(a),this.onChangeLink=a=>{const{dataDanhMucBaoCao:e,startDay:t,endDay:n,khuyenMaiId:o,nhanVienId:i}=this.state;this.setState({BaoCao:e.find((e=>e.MaBaoCao===a)),loaiKhuyenMai:"1",link_api:this.renderLink_Api(a,y.b9.DiemKinhDoanhId,t,n,o||i,"","")},(()=>{this.setChangeBaoCao(a),this.reportViewer.current.toogleBtnExcel()}))},this.onChangeDate=(a,e,t)=>{const{BaoCao:n,nhanVienId:o,maTaiKhoan:i}=this.state;if("bang-ke-giao-hang-theo-nhan-vien"===n.MaBaoCao){this.reportViewer.current.toogleBtnExcel();let a=[];a.push("TuDong eq false"),a.push(`NhanVienGiaoHang_Id eq ${o}`),a.push(`NguoiTao eq '${i}'`),a.push(`(NgayXuat gt (datetime'${(0,d.A)(e,"yyyy-MM-dd")}') and NgayXuat lt (datetime'${(0,d.A)(t,"yyyy-MM-dd")}T23:59:59.000'))`),this.setState({wherePhieuXuat:a})}else a&&this.setState({startDay:e?(0,d.A)(e,"yyyy-MM-dd"):"",endDay:t?(0,d.A)(t,"yyyy-MM-dd"):""},(()=>this.setChangeBaoCao(n.MaBaoCao,"onChangeDate")))},this.onChangeKhuyenMai=a=>{a&&a!==this.state.khuyenMaiId&&(this.reportViewer.current.toogleBtnExcel(),this.setState({khuyenMaiId:a},(()=>this.setStateLinkApi(this.state.khuyenMaiId))))},this.onChangeNCC=a=>{const{params:e}=this.props,{BaoCao:t,startDay:n,endDay:o}=this.state;this.reportViewer.current.toogleBtnExcel(),e.NhomBaoCao.Ma===D.K.MuaHang.Ma?a&&a!==this.state.nccId&&this.setState({nccId:a},(()=>this.setState({link_api:this.renderLink_Api(t.MaBaoCao,y.b9.DiemKinhDoanhId,n,o,this.state.nccId,"","")}))):this.setState({nccId:a},(()=>this.setStateLinkApi(this.state.nccId)))},this.onChangeNguoiTao=a=>{const{BaoCao:e,nhanVienId:t,startDay:n,endDay:o}=this.state;if("bang-ke-giao-hang-theo-nhan-vien"===e.MaBaoCao){this.reportViewer.current.toogleBtnExcel();let e=[];e.push("TuDong eq false"),e.push(`NhanVienGiaoHang_Id eq ${t}`),e.push(`NguoiTao eq '${a}'`),e.push(`(NgayXuat gt (datetime'${n}') and NgayXuat lt (datetime'${o}T23:59:59.000'))`),this.setState({wherePhieuXuat:e,maTaiKhoan:a||""})}else this.reportViewer.current.toogleBtnExcel(),this.setState({maTaiKhoan:a||""},(()=>this.setStateLinkApi(this.state.maTaiKhoan)))},this.onChangeNhanVien=a=>{const{BaoCao:e,startDay:t,endDay:n}=this.state;a&&a!==this.state.nhanVienId&&(this.reportViewer.current.toogleBtnExcel(),this.setState({nhanVienId:a},(()=>this.setState({link_api:this.renderLink_Api(e.MaBaoCao,y.b9.DiemKinhDoanhId,t,n,this.state.nhanVienId,"","")}))))},this.onChangeLoaiKhuyenMai=a=>{this.reportViewer.current.toogleBtnExcel();const{BaoCao:e}=this.state;this.setState({loaiKhuyenMai:a},(()=>this.setChangeBaoCao(e.MaBaoCao)))},this.onChangePhieuXuat=a=>{this.reportViewer.current.toogleBtnExcel(),this.setState({phieuXuatId:a},(()=>this.setStateLinkApi(this.state.phieuXuatId)))},this.setChangeBaoCao=(a,e)=>{const{loaiKhuyenMai:t,startDay:n,endDay:o}=this.state,{params:i}=this.props;i.NhomBaoCao.Ma===D.K.KhuyenMai.Ma?"onChangeDate"===e?this.setState({khuyenMaiId:null},(()=>this.setStateLinkApi(""))):"1"===t?(0,p.Pq)("KhuyenMais?$filter=TrangThai eq true and SoLuongNganSach gt 0&$orderby=NgayTao desc","GET",null).then((a=>{var e;return this.setState({khuyenMaiId:null===(e=a.value[0])||void 0===e?void 0:e.Id},(()=>this.setStateLinkApi(this.state.khuyenMaiId)))})):"0"===t&&(0,p.Pq)("KhuyenMais?$filter=TrangThai eq true and (SoLuongNganSach eq 0)&$orderby=NgayTao desc","GET",null).then((a=>{var e;return this.setState({khuyenMaiId:null===(e=a.value[0])||void 0===e?void 0:e.Id},(()=>this.setStateLinkApi(this.state.khuyenMaiId)))})):i.NhomBaoCao.Ma===D.K.NhanVien.Ma||"cong-no-kh"===a||i.NhomBaoCao.Ma===D.K.NhaCungCap.Ma?"onChangeDate"===e?this.setStateLinkApi(this.state.nhanVienId):i.NhomBaoCao.Ma===D.K.NhanVien.Ma?(0,p.Pq)(`DM_NhanVien?$filter=IsDeleted eq false and MaPhongBan eq '${S.I.GiaoHang}'`,"GET",null).then((a=>this.setState({nhanVienId:a.value[0].Id},(()=>{let a=[];a.push("TuDong eq false"),a.push(`NhanVienGiaoHang_Id eq ${this.state.nhanVienId}`),a.push(`NguoiTao eq '${y.lg.MaTaiKhoan}'`),a.push(`NgayXuat gt (datetime'${n}') and NgayXuat lt (datetime'${o}T23:59:59.000')`),this.setState({wherePhieuXuat:a},(()=>{(0,p.Pq)(`Sale_XuatHang?$filter=${this.state.wherePhieuXuat.join(" and ")}`).then((a=>this.setState({phieuXuatId:a.value[0].Id},(()=>{this.setState({isShowTbPhieuXuat:!1}),this.setStateLinkApi(this.state.phieuXuatId)})))).catch((a=>{this.setState({isShowTbPhieuXuat:!0})}))}))})))):this.setState({nhanVienId:null},(()=>this.setStateLinkApi(""))):i.NhomBaoCao.Ma===D.K.MuaHang.Ma||i.NhomBaoCao.Ma===D.K.HangHoa.Ma?"onChangeDate"===e?this.setStateLinkApi(this.state.nccId):(0,p.Pq)(`DM_LienHe?$filter=IsDeleted ne true and NhomLienHe_Id eq '${N.M.NCC}'`,"GET",null).then((a=>this.setState({nccId:a.value[0].Id},(()=>this.setStateLinkApi(this.state.nccId))))):"san-luong-ban-hang-theo-khach-hang"===a||i.NhomBaoCao.Ma===D.K.BanHang.Ma?this.setStateLinkApi(this.state.maTaiKhoan):this.setStateLinkApi("")},this.setStateLinkApi=a=>{const{params:e}=this.props,{startDay:t,endDay:n,BaoCao:o,loaiKhuyenMai:i}=this.state;o.MaBaoCao&&("1"===i?"san-luong-ban-hang-theo-khach-hang"===o.MaBaoCao||e.NhomBaoCao.Ma===D.K.BanHang.Ma?this.setState({link_api:this.renderLink_Api(o.MaBaoCao,y.b9.DiemKinhDoanhId,t,n,"",a,"")}):this.setState({link_api:this.renderLink_Api(o.MaBaoCao,y.b9.DiemKinhDoanhId,t,n,a,"","")}):"0"===i?this.setState({link_api:this.renderLink_Api("phan-tich-hieu-qua-khuyen-mai-khong-phan-bo",y.b9.DiemKinhDoanhId,t,n,a,"","")}):this.setState({link_api:this.renderLink_Api(o.MaBaoCao,y.b9.DiemKinhDoanhId,t,n,a,"","")}))},this.state={BaoCao:{},openMauIn:!1,link_api:"",startDay:(0,d.A)(new Date,"yyyy-MM-dd"),endDay:(0,d.A)(new Date,"yyyy-MM-dd"),dataDanhMucBaoCao:[],khuyenMaiId:null,nhanVienId:null,loaiKhuyenMai:"1",nccId:null,maTaiKhoan:y.lg.MaTaiKhoan,phieuXuatId:null,wherePhieuXuat:[]},this.reportViewer=n.createRef(),this.reloadBaoCao=this.reloadBaoCao.bind(this)}componentDidMount(){this.getDataDanhMucBaoCao()}reloadBaoCao(){const{BaoCao:a,startDay:e,endDay:t,khuyenMaiId:n}=this.state;(0,p.Pq)(`DanhMucBaoCaos?$expand=SYS_KhoGiay,SYS_NhomBaoCao&$filter=MaBaoCao eq '${a.MaBaoCao}' and HienThi eq true`).then((o=>o.value.length&&this.setState({BaoCao:o.value[0],link_api:this.renderLink_Api(a.MaBaoCao,y.b9.DiemKinhDoanhId,e,t,n,"",(new Date).getTime())}))).catch((a=>(0,M.a3)("Kh\xf4ng th\u1ec3 reload b\xe1o c\xe1o","Th\xf4ng b\xe1o")))}getDataDanhMucBaoCao(){const{params:a}=this.props;(0,p.Pq)(`DanhMucBaoCaos?$expand=SYS_KhoGiay,SYS_NhomBaoCao&$filter=SYS_NhomBaoCao/MaNhomBaoCao eq '${a.NhomBaoCao.Ma}' and HienThi eq true`).then((a=>this.setState({dataDanhMucBaoCao:a.value},(()=>{a.value.length&&this.setState({BaoCao:a.value[0]},(()=>{const{BaoCao:a}=this.state;this.setChangeBaoCao(a.MaBaoCao)}))})))).catch((a=>(0,M.a3)("Can't load data Doanh Muc Bao Cao","Warn")))}renderLink_Api(){let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",i=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"";return"cong-no-kh"!==a?`CrazyReport/LoadReport?MaBaoCao=${a}&DiemKinhDoanhId=${arguments.length>1&&void 0!==arguments[1]?arguments[1]:""}&tuNgay=${e}&denNgay=${t}&phieuId=${n}&nguoiTao=${o}&t=${i}`:`CrazyReport/LoadReport?MaBaoCao=${a}&DiemKinhDoanhId=&tuNgay=${e}&denNgay=${t}&phieuId=${n}&nguoiTao=${o}&t=${i}`}render(){const{BaoCao:a,link_api:e,dataDanhMucBaoCao:t,openMauIn:n,khuyenMaiId:h,nhanVienId:d,loaiKhuyenMai:u,nccId:g,maTaiKhoan:c,phieuXuatId:p,wherePhieuXuat:M}=this.state,{params:k}=this.props;let I=[];I.push("TrangThai eq true"),"1"===u?I.push("SoLuongNganSach gt 0"):I.push("SoLuongNganSach eq 0 or SoLuongNganSach eq null ");let T=[];T.push(`NhomLienHe_Id eq '${N.M.NCC}'`),T.push("IsDeleted ne true");let K=[];return K.push("IsDeleted ne true"),"bang-ke-giao-hang-theo-nhan-vien"===a.MaBaoCao&&K.push(`MaPhongBan eq '${S.I.GiaoHang}'`),(0,s.jsxs)(i.A,{children:[(0,s.jsxs)(o.A,{NoTabs:!0,PageBaoCao:!0,children:[(0,s.jsx)(l.A,{className:"mb-2",type:"radio-list-custom",title:"M\u1ed1i quan t\xe2m",titleBody:k.NhomBaoCao.Ten,data:t.map((a=>({label:a.TenRutGon,value:a.MaBaoCao}))),renderCustom:"true"===y.Tq.show_print_edit?(0,s.jsx)("span",{onClick:()=>this.setState({openMauIn:!0}),children:(0,s.jsx)(C.A,{fa:"pencil"})}):"",value:a.MaBaoCao,onChange:(a,e)=>this.onChangeLink(e)}),(k.NhomBaoCao.Ma===D.K.HangHoa.Ma||k.NhomBaoCao.Ma===D.K.MuaHang.Ma)&&(0,s.jsx)(l.A,{className:"mb-2",title:"Nh\xe0 cung c\u1ea5p",type:"dropdown-list",placeholder:"Ch\u1ecdn nh\xe0 cung c\u1ea5p...",url:"DM_LienHe",where:T.join(" and "),value:g,valueField:"Id",textField:"Ten",onChange:a=>this.onChangeNCC(a)}),"phan-tich-hieu-qua-khuyen-mai"===a.MaBaoCao&&(0,s.jsx)(l.A,{className:"mb-2",type:"radio-list",title:"Lo\u1ea1i khuy\u1ebfn m\xe3i",data:[{value:"1",label:"C\xf3 ph\xe2n b\u1ed5"},{value:"0",label:"Kh\xf4ng ph\xe2n b\u1ed5"}],value:u,onChange:(a,e)=>this.onChangeLoaiKhuyenMai(e)}),k.NhomBaoCao.Ma===D.K.KhuyenMai.Ma&&(0,s.jsx)(l.A,{className:"mb-2",title:"Khuy\u1ebfn m\xe3i",type:"dropdown-list",placeholder:"Ch\u1ecdn ch\u01b0\u01a1ng tr\xecnh khuy\u1ebfn m\xe3i...",url:"KhuyenMais",where:I.join(" and "),value:h,valueField:"Id",textField:"Ten",textFieldSub:"MaKhuyenMai",onChange:a=>this.onChangeKhuyenMai(a)}),(k.NhomBaoCao.Ma===D.K.NhanVien.Ma||"cong-no-kh"===a.MaBaoCao||k.NhomBaoCao.Ma===D.K.NhaCungCap.Ma)&&(0,s.jsx)(l.A,{className:"mb-2",title:"bang-ke-giao-hang-theo-nhan-vien"===a.MaBaoCao||"cong-no-kh"===a.MaBaoCao||k.NhomBaoCao.Ma===D.K.NhaCungCap.Ma?"Nh\xe2n vi\xean giao h\xe0ng":"Nh\xe2n vi\xean",type:"dropdown-list",placeholder:"Ch\u1ecdn nh\xe2n vi\xean...",url:"DM_NhanVien",where:K.join(" and "),value:d,valueField:"Id",textField:"TenNhanVien",textFieldSub:"MaNhanVien",onChange:a=>this.onChangeNhanVien(a)}),("bang-ke-giao-hang-theo-nhan-vien"===a.MaBaoCao||"san-luong-ban-hang-theo-khach-hang"===a.MaBaoCao||k.NhomBaoCao.Ma===D.K.BanHang.Ma)&&(0,s.jsx)(l.A,{className:"mb-2",title:"Ng\u01b0\u1eddi t\u1ea1o",type:"dropdown-list",placeholder:"Ch\u1ecdn ng\u01b0\u1eddi t\u1ea1o ...",url:"TaiKhoans",where:`loai_tai_khoan eq 'don_vi' and IDDonVi eq '${y.lg.IDDonVi}' and SYS_DM_VaiTro/MaVaiTro eq 'dieuhanh' or SYS_DM_VaiTro/MaVaiTro eq 'ketoan' and TinhTrangHoatDong eq true`,valueField:"MaTaiKhoan",textField:"TenHienThi",value:c,onChange:a=>this.onChangeNguoiTao(a)}),"bao-cao-ton-kho"!==a.MaBaoCao&&"phan-tich-hieu-qua-khuyen-mai"!==a.MaBaoCao&&(0,s.jsx)(l.A,{title:"Th\u1eddi gian",type:"date-report",onChangeDate:this.onChangeDate,changeReportViewer:()=>this.reportViewer.current.toogleBtnExcel(),alwaysTrueReportViewer:()=>this.reportViewer.current.loaderPDF()}),"bang-ke-giao-hang-theo-nhan-vien"===a.MaBaoCao&&(0,s.jsx)(l.A,{className:"mt-2",title:"Phi\u1ebfu xu\u1ea5t",type:"dropdown-list",placeholder:"Ch\u1ecdn phi\u1ebfu xu\u1ea5t...",url:"Sale_XuatHang",where:M.join(" and "),valueField:"Id",textField:"MaXuatHang",textFieldSub:"ThanhTien",value:p,onChange:a=>this.onChangePhieuXuat(a)})]}),(0,s.jsx)(r,{children:(0,s.jsx)(B,{ref:this.reportViewer,title:a.TenRutGon,url_pdf:e,defaultScale:1.4})}),n&&(0,s.jsx)(m.A,{open:n,Id:a.Id,TieuDeRutGon:a.TenRutGon,reloadList:this.reloadBaoCao,onClose:()=>this.setState({openMauIn:!1})})]})}}},66671:()=>{},82787:()=>{},97492:()=>{}}]);