12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157 |
- <template>
- <div class="main-contain">
- <div class="app-container "
- style="padding-left:0px;margin:0px;"
- v-loading="loading"
- element-loading-text="拼命加载中">
- <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
- <div>
- <span style="font-size:14px;color:#606266">操作时间:</span>
- <el-date-picker
- size="small"
- v-model="start_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 150px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="startTimeChange"
- :picker-options="pickerOptions"
- :clearable="false"
- ></el-date-picker>
- <span>-</span>
- <el-date-picker
- size="small"
- v-model="end_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 150px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="endTimeChange"
- :picker-options="pickerOptions"
- :clearable="false"
- ></el-date-picker>
- <span style="font-size:14px;color:#606266">耗材类型:</span>
- <el-select v-model="good_type" style="width:200px;margin-right:10px;" placeholder="请选择"
- filterable
- @change="changeGoodTypeName">
- <el-option
- v-for="item in goodTypeList"
- :key="item.id"
- :label="item.type_name"
- :value="item.id">
- </el-option>
- </el-select>
- <el-input v-model="keyword" style="width:200px" placeholder="请输入耗材名称或生产厂商" ></el-input>
- <el-button type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
- </div>
- <div>
- <!-- <el-button type="primary" size="small" @click="toOverCount">调试</el-button> -->
- <el-button type="primary" size="small" @click="toPrint">打印</el-button>
- <el-button type="primary" size="small" @click="exportList">导出</el-button>
- </div>
- </div>
-
- <el-table
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- :data="tableList"
- :class="signAndWeighBoxPatients"
- border
- >
- <el-table-column label="耗材编码" align="center" v-if="org_id ==9956 || org_id == 0">
- <template slot-scope="scope">
- <span v-if="scope.row.good_number>0">{{ scope.row.good_number?scope.row.good_number:"" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="耗材类型" align="center">
- <template slot-scope="scope">
- {{getGoodTypeName(scope.row.good_type_id)}}
- </template>
- </el-table-column>
- <el-table-column label="耗材名称" align="center">
- <template slot-scope="scope">
- {{scope.row.good_name}}
- </template>
- </el-table-column>
-
- <el-table-column label="规格&单位" align="center">
- <template slot-scope="scope">
- {{scope.row.specification_name}}/{{scope.row.packing_unit}}
- </template>
- </el-table-column>
- <el-table-column label="生产厂商" align="center">
- <template slot-scope="scope">
- {{getManufacturName(scope.row.manufacturer)}}
- </template>
- </el-table-column>
- <el-table-column label="经销商" align="center">
- <template slot-scope="scope">
- {{getDearName(scope.row.dealer)}}
- </template>
- </el-table-column>
- <el-table-column label="期初结余" align="center">
-
- <el-table-column prop="stockIn" label="数量" width="100">
-
- </el-table-column>
-
- <el-table-column prop="stock_in_price" label="进货金额" width="100">
-
- </el-table-column>
- <el-table-column prop="stockMoney" label="销售金额" width="100">
-
- </el-table-column>
-
- </el-table-column>
- <el-table-column label="本期增加" align="center">
-
- <el-table-column prop="stockAdd" label="数量" width="100">
-
- </el-table-column>
-
- <el-table-column prop="addStockMoney" label="进货金额" width="100">
-
- </el-table-column>
- <el-table-column prop="saleStockMoney" label="销售金额" width="100">
- </el-table-column>
-
- </el-table-column>
-
- <el-table-column label="本期减少" align="center">
- <el-table-column prop="outStock" label="数量" width="100">
- </el-table-column>
- <el-table-column prop="stockOutprice" label="进货金额" width="100">
- </el-table-column>
- <el-table-column prop="saleOutMoney" label="销售金额" width="100">
- </el-table-column>
- </el-table-column>
-
- <el-table-column label="期末结余" align="center">
- <el-table-column prop="overStock" label="数量" width="100">
- </el-table-column>
- <el-table-column prop="overPrice" label="进货金额" width="100">
- </el-table-column>
- <el-table-column prop="overMoney" label="销售金额" width="100">
- </el-table-column>
- </el-table-column>
-
-
- </el-table>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100,200,300,400,500,1000]"
- :page-size="10"
- background
- align="right"
- style="margin-top:20px;"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
-
-
-
-
-
- </div>
- </template>
- <script>
- import { getStorehouseList,getNewPurchaseStockQuery,getGoodOverCount } from "@/api/drug/drug"
- import {
- getStockDrugCount
- } from "@/api/stock";
- import { uParseTime } from '@/utils/tools'
- const moment = require('moment')
- export default {
-
- data(){
- return{
- tableList:[],
- goodList:[
- {id:1,name:"全部耗材"},
- {id:2,name:"库存预警"},
- ],
- houseList:[],
- storehouse_id:0,
- good_type:0,
- multipleSelection: [],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- manufacturerList:[],
- limit:10,
- page:1,
- total:0,
- keyword:"",
- goodTypeList:[],
- start_time:"",
- end_time:"",
- countList:[],
- outCountList:[],
- autoCountList:[],
- cancelCountList:[],
- org_id:this.$store.getters.xt_user.org_id,
- dialogVisible:false,
- start_first_time:"",
- end_first_time:"",
- tableData:[],
- good_id:0,
- patientList:[],
- good_name:"",
- specification_name:"",
- loading:false,
- pickerOptions:{ //禁用当前日期之前的日期
- disabledDate(v) {
- return v.getTime() < 1667491200000
- },
- },
- dealerList:[],
- }
-
- },
- methods:{
- changeStorehouseName(){
-
- },
- changeGoodTypeName(){
- this.getlist()
- },
- getStorehouseList(){
- getStorehouseList().then(response=>{
- if(response.data.state == 1){
- var houseList = response.data.data.list
- var obj = {id:0,storehouse_name:"全部"}
- this.houseList.push(obj)
- for(let i=0;i<houseList.length;i++){
- this.houseList.push(houseList[i])
- }
- this.manufacturerList = response.data.data.manufacturerList
- var obj = {id:0,type_name:"全部"}
- this.goodTypeList.push(obj)
- var goodTypeList = response.data.data.goodTypeList
- for(let i=0;i<goodTypeList.length;i++){
- this.goodTypeList.push(goodTypeList[i])
- }
- this.patientList = response.data.data.patientList
- this.dealerList = response.data.data.dealerList
- }
- })
- },
- getlist(){
- this.loading = true
- var params = {
- good_type:this.good_type,
- keyword:this.keyword,
- page:this.page,
- limit:this.limit,
- start_time:this.start_time,
- end_time:this.end_time,
- }
- getNewPurchaseStockQuery(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
-
- this.loading = false
- for(let i=0;i<list.length;i++){
-
- if(this.org_id ==10210){
- list[i].stockIn = list[i].GoodStartFlowInfo.over_count
- }else{
-
- console.log("入库",this.getAllStockIn(list[i].StWarehousingInfoTwo))
- console.log("盘盈",this.getAllStockInFlow(list[i].WareStartInStockFlow))
- console.log("出库",this.getAllOutStockIn(list[i].WarehouseOutInfoTenty) )
- console.log("盘亏",this.getAllStockOutFlow(list[i].WareStartOutStockFlow))
- //针对武穴软水盐的问题
- if(list[i].id== 5052){
- list[i].stockIn = list[i].GoodStartFlowInfo.over_count
- }else{
- list[i].stockIn = this.getAllStockIn(list[i].StWarehousingInfoTwo) + this.getAllStockInFlow(list[i].WareStartInStockFlow) - this.getAllOutStockIn(list[i].WarehouseOutInfoTenty) - this.getAllStockOutFlow(list[i].WareStartOutStockFlow)
- if(list[i].stockIn <0){
- list[i].stockIn =0
- }
- }
-
- }
- // list[i].stockIn = list[i].GoodStartFlowInfo.over_count
- list[i].stock_in_price = "/"
- list[i].stockMoney = "/"
-
-
- list[i].stockAdd = this.getWarehouseInfoOne(list[i].StartFlowWarehouseInfo,list[i].WareStartEndStockInventoryProfit)//期间增加
- list[i].addStockMoney = "/"
- list[i].saleStockMoney = "/"
-
- list[i].outStock = this.getWarehosueOutInfo(list[i].WarehouseOutInfoStart,list[i].WareStartEndStockInventoryLosses,list[i].StartEndCancelFLowInfo)//本期减少
- list[i].stockOutprice = "/"
- list[i].saleOutMoney = "/"
- if(this.org_id == 10265){
- list[i].overStock = list[i].GoodEndFlowInfo.over_count
- }else{
- console.log("期初",list[i].stockIn)
- console.log("增加",list[i].stockAdd)
- console.log("出库",list[i].outStock)
- if((list[i].stockIn + list[i].stockAdd - list[i].outStock)>0 ){
- list[i].overStock = list[i].stockIn + list[i].stockAdd - list[i].outStock
- }else{
- list[i].overStock = 0
- }
-
- }
-
-
- list[i].overPrice = "/"
- list[i].overMoney = "/"
-
- }
- console.log("listwowowoowowowow",list)
- this.tableList = list
- this.total = response.data.data.total
-
- this.manufacturerList = response.data.data.manufacturerList
-
-
- }
- })
- },
- getManufacturName(id){
- var manufacturer_name = ""
- for(let i=0;i<this.manufacturerList.length;i++){
- if(id == this.manufacturerList[i].id){
- manufacturer_name = this.manufacturerList[i].manufacturer_name
- }
- }
- return manufacturer_name
- },
- handleSizeChange(val) {
- this.limit = val;
- this.getlist()
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getlist()
- },
- handleSizeChangeOne(val) {
- this.limitone = val;
- this.toDialogClick(this.good_id,this.good_name,this.specification_name)
- },
- handleCurrentChangeOne(val) {
- this.pageone = val;
- this.toDialogClick(this.good_id,this.good_name,this.specification_name)
- },
- seach(){
- this.goodTypeList = []
- this.getStorehouseList()
- this.getlist()
- },
- getGoodTypeName(id){
- var type_name = ""
- for(let i=0;i<this.goodTypeList.length;i++){
- if(id == this.goodTypeList[i].id){
- type_name = this.goodTypeList[i].type_name
- }
- }
- return type_name
- },
- getHouseName(id){
- var storehouse_name = ""
- for(let i=0;i<this.houseList.length;i++){
- if(id == this.houseList[i].id){
- storehouse_name = this.houseList[i].storehouse_name
- }
- }
- return storehouse_name
- },
- getWareInfoCount(val,storehouse_id){
- var count = 0
- if(val.length > 0){
- for(let i=0;i<val.length;i++){
- if(val[i].storehouse_id == storehouse_id){
- count +=val[i].warehousing_count
- }
- }
- }
- if(count > 0){
- return count
- }else{
- return ""
- }
- },
- getStockDrugCount(){
- var params ={
- keywords: this.keywords,
- start_time:this.start_time,
- end_time:this.end_time,
- }
- getStockDrugCount(params).then(response=>{
- if(response.data.state == 1){
- var outlist = response.data.data.outList
- this.outCountList = outlist
- var autoCount = response.data.data.autoCount
- this.autoCountList = autoCount
- var totalCount = response.data.data.totalCount
- this.cancelCountList = totalCount
- }
- })
- },
- getWareInfoCountOne(val,storehouse_id){
- var count = 0
- if(val.length > 0){
- for(let i=0;i<val.length;i++){
- if(val[i].storehouse_id == storehouse_id){
- count +=val[i].stock_count
- }
- }
- }
- if(count > 0){
- return count
- }else{
- return ""
- }
- },
- getOutCount(id){
- var count = 0
- for(let i=0;i<this.outCountList.length;i++){
- if(id == this.outCountList[i].good_id){
- count = this.outCountList[i].count
- }
- }
- return count
- },
- getAutoCount(id){
- var count= 0
- for(let i=0;i<this.autoCountList.length;i++){
- if(id == this.autoCountList[i].good_id){
- count = this.autoCountList[i].count
- }
- }
- return count
- },
- getCancelCount(id){
- var count = 0
- for(let i=0;i<this.cancelCountList.length;i++){
- if(id == this.cancelCountList[i].good_id){
- count = this.cancelCountList[i].count
- }
- }
- return count
- },
- getCancelCountInfo(cancel_stock_info,storehouse_id){
- var count = 0
- if(cancel_stock_info.length >0){
- for(let i=0;i<cancel_stock_info.length;i++){
- if(storehouse_id == cancel_stock_info[i].storehouse_id){
- count += cancel_stock_info[i].count
- }
- }
- }
- return count
- },
- getWareOutInfoCount(warehouse_out_info,storehouse_id){
- var count = 0
- if(warehouse_out_info.length > 0){
- for(let i=0;i<warehouse_out_info.length;i++){
- if(storehouse_id == warehouse_out_info[i].storehouse_id){
- count +=warehouse_out_info[i].count
- }
- }
- }
- return count
- },
- getInCount(id){
- var count= 0
- for(let i=0;i<this.countList.length;i++){
- if(id == this.countList[i].good_id){
- count = this.countList[i].count
- }
- }
- return count
- },
- getOutCount(id){
- var count = 0
- for(let i=0;i<this.outCountList.length;i++){
- if(id == this.outCountList[i].good_id){
- count = this.outCountList[i].count
- }
- }
- return count
- },
- getAutoCount(id){
- var count= 0
- for(let i=0;i<this.autoCountList.length;i++){
- if(id == this.autoCountList[i].good_id){
- count = this.autoCountList[i].count
- }
- }
- return count
- },
- getCancelCount(id){
- var count = 0
- for(let i=0;i<this.cancelCountList.length;i++){
- if(id == this.cancelCountList[i].good_id){
- count = this.cancelCountList[i].count
- }
- }
- return count
- },
- getStockCount(id){
- var stock_count = 0
- for(let i=0;i<this.countList.length;i++){
- if(id == this.countList[i].good_id){
- stock_count = this.countList[i].stock_count
- }
- }
- return stock_count
- },
- getWareInfo(arr){
- var total = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += parseInt(arr[i].warehousing_count)
- }
- }else{
- total = ""
- }
- return total
- },
- getOverplus(arr){
- var total = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].stock_count
- }
- }else{
- total = ""
- }
- return total
- },
- getCancelInfo(arr){
- var total = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].count
- }
- }else{
- total = ""
- }
- return total
- },
- getOverFlushInfo(arr){
- var total = 0
- if(arr.length >0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].stock_count
- }
- }
- return total
- },
-
- startFirstTimeChange(){
- this.getlist()
- },
- endEndTimeChange(){
- this.getlist()
- },
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- getName(id){
- var name = ""
- for(let i=0;i<this.patientList.length;i++){
- if(id == this.patientList[i].id){
- name = this.patientList[i].name
- }
- }
- return name
- },
- endTimeChange(){
- this.getlist()
- },
- startTimeChange(){
- this.getlist()
- },
- getWarehouseInfoStart(arr1,arr2,arr3,arr4,arr5){
- var count =0
- var countOne =0
- var countTwo= 0
- var countthree = 0 //期初
- var countfour = 0
- var countfive = 0
- if(arr1!=null && arr1.length > 0){
- for(let i=0;i<arr1.length;i++){
- countOne +=arr1[i].count
- }
- }
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- countTwo +=arr2[i].count
- }
- }
- if(arr3!=null && arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- countthree +=arr3[i].count
- }
- }
- if(arr4!=null && arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- countfour +=arr4[i].count
- }
- }
- if(arr5!=null && arr5.length > 0){
- for(let i=0;i<arr5.length;i++){
- countfive +=arr5[i].count
- }
- }
- console.log("countOne",countOne)
- console.log("countTwo",countTwo)
- console.log("countthree",countthree)
- console.log("countfour",countfour)
- console.log("*********************")
- count = countOne - countTwo + countthree - countfour + countfive
- if(count > 0 ){
- return count
- }else{
- return 0
- }
- },
- getWarehouseInfo(val){
- var count =0
- for(let i=0;i<val.length;i++){
- count +=val[i].stock_count
- }
- if(count > 0 ){
- return count
- }else{
- return 0
- }
- },
- getWarehouseInfoOne(val,val2){
- var count =0
- var countOne = 0
- var all_count = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- count +=val[i].count
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- countOne +=val2[i].count
- }
- }
- all_count = count + countOne
- console.log("count2332323223232o2222222222wide",count)
- console.log("countONE23232322323323223",countOne)
- console.log("all_count9999999999999wode",all_count)
- console.log("-------------------------------------------")
- if(all_count > 0 ){
- return all_count
- }else{
- return 0
- }
- },
- getAddStockMony(val,val2){
- var total_price =0
- var total_price_one = 0
- var all_price = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- total_price +=val[i].count * val[i].buy_price
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- total_price_one +=val2[i].count * val2[i].price
- }
- }
- all_price = total_price + total_price_one
- if(all_price >0 ){
- return total_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getSaleStockMony(val,val2){
- var total_price =0
- var total_price_one = 0
- var all_price = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- total_price +=val[i].count * val[i].price
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- total_price_one +=val2[i].count * val2[i].price
- }
- }
- all_price = total_price + total_price_one
- if(all_price >0 ){
- return all_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getWarehouseOut(val){
- var count = 0
- for(let i=0;i<val.length;i++){
- count +=val[i].count
- }
- if(count >0){
- return count
- }else{
- return 0
- }
- },
- open(){
- // this.start_time = moment().year(2022).month(10).date(4).format('YYYY-MM-DD')
- this.start_time = moment().startOf('month').format('YYYY-MM-DD')
- this.end_time = moment(new Date()).add('year',0).format("YYYY-MM-DD")
- this.houseList = []
- this.goodTypeList= []
- this.getStorehouseList()
- this.getlist()
- //this.getStockDrugCount()
- },
- getWarehouseInfoStartPrice(arr,arr1,arr2,arr3,arr4){
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var total_price_three = 0
- var total_price_four = 0
- var total_price_all = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_price += arr[i].count * arr[i].buy_price
- }
- }
- if(arr1!=null && arr1.length > 0){
- for(let i=0;i<arr1.length;i++){
- total_price_one +=arr1[i].count * arr1[i].buy_price
- }
-
- }
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- total_price_two +=arr2[i].count * arr2[i].buy_price
- }
-
- }
- if(arr3!=null && arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- total_price_three +=arr3[i].count * arr3[i].buy_price
- }
-
- }
- if(arr4!=null && arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- total_price_three +=arr4[i].count * arr4[i].buy_price
- }
-
- }
- total_price_all = total_price - total_price_one + total_price_two - total_price_three + total_price_four
- if (total_price_all > 0) {
- return total_price_all.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getWarehouseInfoStartMoney(arr,arr1,arr2,arr3,arr4){
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var total_price_three = 0
- var total_price_four = 0
- var total_price_all = 0
- if(arr!=null && arr.length >0){
- for(let i=0;i<arr.length;i++){
- total_price +=arr[i].count * arr[i].price
- }
- }
- if(arr1!=null && arr1.length > 0){
- for(let i=0;i<arr1.length;i++){
- total_price_one +=arr1[i].count * arr1[i].price
- }
-
- }
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- total_price_two +=arr2[i].count * arr2[i].price
- }
-
- }
- if(arr3!=null && arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- total_price_three +=arr3[i].count * arr3[i].price
- }
-
- }
- if(arr4!=null && arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- total_price_four +=arr4[i].count * arr4[i].price
- }
-
- }
- total_price_all = total_price - total_price_one + total_price_two - total_price_three + total_price_four
- if (total_price_all > 0) {
- return total_price_all.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getWarehosueOutInfo(val,val2,val3){
- var count = 0
- var count_one = 0
- var all_count = 0
- var count_two = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- count +=val[i].count
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- count_one +=val2[i].count
- }
- }
- if(val3!=null && val3.length > 0){
- for(let i=0;i<val3.length;i++){
- count_two +=val3[i].count
- }
- }
- console.log("countwowowoowow3333",count)
- console.log("count_one222222",count_one)
- console.log("count_two222222",count_two)
- all_count = count +count_one - count_two
- console.log("数据我哦我我",all_count)
- if(all_count >0){
- return all_count
- }else{
- return 0
- }
- },
- stockOutprice(val,val2,val3){
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var all_price = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- total_price +=val[i].count * val[i].buy_price
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- total_price_one +=val2[i].count * val2[i].buy_price
- }
- }
- if(val3!=null && val3.length > 0){
- for(let i=0;i<val3.length;i++){
- total_price_two +=val3[i].count * val3[i].buy_price
- }
- }
- all_price = total_price + total_price_one - total_price_two
- if(all_price >0){
- return all_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- saleOutprice(val,val2,val3){
- var total_price = 0
- var total_price_one = 0
- var all_price = 0
- var total_price_two = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- total_price +=val[i].count * val[i].xt_warehouse_info.packing_price
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- total_price_one +=val2[i].count * val2[i].price
- }
- }
- if(val3!=null && val3.length > 0){
- for(let i=0;i<val3.length;i++){
- total_price_two +=val3[i].count * val3[i].price
- }
- }
- all_price = total_price + total_price_one - total_price_two
- if(all_price >0){
- return all_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getEndWarehouseInfo(val,val3,val1,val2,val4){
- var count = 0
- var count_one = 0
- var count_two = 0
- var count_three =0
- var count_four = 0
- var all_count = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- count +=val[i].count
- }
- }
- if(val1!=null&&val1.length >0){
- for(let i=0;i<val1.length;i++){
- count_one +=val1[i].count
- }
- }
- if(val3!=null&& val3.length > 0){
- for(let i=0;i<val3.length;i++){
- count_three +=val3[i].count
- }
- }
- if(val2!=null&&val2.length >0){
- for(let i=0;i<val2.length;i++){
- count_two +=val2[i].count
- }
- }
- if(val4!=null&&val4.length >0){
- for(let i=0;i<val4.length;i++){
- count_four +=val4[i].count
- }
- }
- all_count = count- count_three + count_one - count_two + count_four
- if(all_count >0){
- return all_count
- }else{
- return 0
- }
- },
- getEndOverPrice(val,val3,val1,val2,val4){
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var total_price_three = 0
- var total_price_four =0
- var all_price = 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- total_price +=val[i].count * val[i].buy_price
- }
- }
- if(val1!=null && val1.length > 0){
- for(let i=0;i<val1.length;i++){
- total_price_one +=val1[i].count * val1[i].buy_price
- }
- }
- if(val3!=null && val3.length > 0){
- for(let i=0;i<val3.length;i++){
- total_price_three +=val3[i].count * val3[i].buy_price
- }
- }
- if(val2!=null && val2.length > 0){
- for(let i=0;i<val2.length;i++){
- total_price_two +=val2[i].count * val2[i].buy_price
- }
- }
- if(val4!=null && val4.length > 0){
- for(let i=0;i<val4.length;i++){
- total_price_four +=val4[i].count * val4[i].buy_price
- }
- }
- console.log("total_price",total_price)
- console.log("total_price_three",total_price_three)
- console.log("total_price_two",total_price_two)
- console.log("total_price_one",total_price_one)
- console.log("total_price_four",total_price_four)
- all_price = total_price- total_price_three +total_price_one - total_price_two + total_price_four
- console.log("arrll_price",all_price)
- if(all_price >0){
- return all_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getEndSalePrice(val,val3,val1,val2,val4){
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var total_price_three = 0
- var total_price_four = 0
- var all_price= 0
- if(val!=null && val.length >0){
- for(let i=0;i<val.length;i++){
- total_price +=val[i].count * val[i].price
- }
- }
- if(val1!=null && val1.length >0){
- for(let i=0;i<val1.length;i++){
- total_price_one +=val1[i].count * val1[i].price
- }
- }
- if(val3!=null && val3.length >0){
- for(let i=0;i<val3.length;i++){
- total_price_three +=val3[i].count * val3[i].price
- }
- }
- if(val2!=null && val2.length >0){
- for(let i=0;i<val2.length;i++){
- total_price_two +=val2[i].count * val2[i].price
- }
- }
- if(val4!=null && val4.length >0){
- for(let i=0;i<val4.length;i++){
- total_price_four +=val4[i].count * val4[i].price
- }
- }
- var all_price = total_price-total_price_three + total_price_one - total_price_two + total_price_four
- if(all_price >0){
- return all_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- toPrint(){
- this.$router.push({path:"/purchase/new/stock/query/print?start_time="+this.start_time+"&end_time="+this.end_time+"&page="+this.page+"&limit="+this.limit+"&keyword="+this.keyword+"&good_type="+this.good_type})
- },
- exportList: function() {
-
- if(this.org_id!=0&& this.org_id!=9956){
-
- for(let i=0;i<this.tableList.length;i++){
- this.tableList[i].index = i+1
- this.tableList[i].query_date = this.start_time+"~"+this.end_time
- this.tableList[i].good_type = this.getGoodTypeName(this.tableList[i].good_type_id)
- this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
- this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
- this.tableList[i].specification_name_one = this.tableList[i].specification_name + "/"+this.tableList[i].packing_unit
-
- }
- import('@/vendor/Export2Excel').then(excel => {
- const multiHeader = [['序号', '查询日期',' 耗材类型','耗材名称','规格&单位','生产产商','经销商', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
- const header = ['', '','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
- const merges = ['A1:A2', 'B1:B2','C1:C2','D1:D2','E1:E2','F1:F2','G1:G2','H1:J1', 'K1:M1', 'N1:P1', 'Q1:S1']
- const filterVal = ['index', 'query_date', 'good_type','good_name','specification_name_one','manufacturer_name','dealer_name','stockIn','stock_in_price','stockMoney','stockAdd','addStockMoney','saleStockMoney','outStock','stockOutprice','saleOutMoney','overStock','overPrice','overMoney']
-
- const data = this.formatJson(filterVal, this.tableList)
-
- const filename = '进销存查询'
-
-
- excel.export_json_to_excel({
- multiHeader,
- header,
- merges,
- data,
- filename
- })
- })
- }
-
- if(this.org_id == 0 || this.org_id == 9956){
-
- for(let i=0;i<this.tableList.length;i++){
- this.tableList[i].index = i+1
- this.tableList[i].query_date = this.start_time+"~"+this.end_time
- this.tableList[i].good_type = this.getGoodTypeName(this.tableList[i].good_type_id)
- this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
- this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
- this.tableList[i].specification_name_one = this.tableList[i].specification_name + "/"+this.tableList[i].packing_unit
- }
- import('@/vendor/Export2Excel').then(excel => {
- const multiHeader = [['序号','耗材编码', '查询日期',' 耗材类型','耗材名称','规格&单位','生产产商','经销商', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
- const header = ['','', '','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
- const merges = ['A1:A2', 'B1:B2','C1:C2','D1:D2','E1:E2','F1:F2','G1:G2','H1:H2','I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1']
- const filterVal = ['index','good_number', 'query_date', 'good_type','good_name','specification_name_one','manufacturer_name','dealer_name','stockIn','stock_in_price','stockMoney','stockAdd','addStockMoney','saleStockMoney','outStock','stockOutprice','saleOutMoney','overStock','overPrice','overMoney']
-
- const data = this.formatJson(filterVal, this.tableList)
-
- const filename = '进销存查询'
-
- excel.export_json_to_excel({
- multiHeader,
- header,
- merges,
- data,
- filename
- })
- })
- }
-
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map(v => filterVal.map(j => v[j]));
- },
- toOverCount(){
- getGoodOverCount().then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.$message.success("调试成功")
- }
- })
- },
- getDearName(id){
- var dear_name = ""
- for(let i=0;i<this.dealerList.length;i++){
- if(id == this.dealerList[i].id){
- dear_name = this.dealerList[i].dealer_name
- }
- }
- return dear_name
- },
- getAllStockIn(val){
- var count = 0
- if(val!=null && val.length>0){
- for(let i=0;i<val.length;i++){
- count+= val[i].warehousing_count
- }
- }
- return count
- },
- getAllOutStockIn(val){
- var count = 0
- if(val!=null && val.length>0){
- for(let i=0;i<val.length;i++){
- count +=val[i].count
- }
- }
- return count
- },
- getAllStockInFlow(val){
- var count = 0
- if(val!=null && val.length>0){
- for(let i=0;i<val.length;i++){
- count+= val[i].count
- }
- }
- return count
- },
- getAllStockOutFlow(val){
- var count = 0
- if(val!=null && val.length>0){
- for(let i=0;i<val.length;i++){
- count+= val[i].count
- }
- }
- return count
- }
- },
-
- }
- </script>
-
|