123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398 |
- <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"
- :picker-options="pickerOptions"
- @change="startTimeChange"
- :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"
- :picker-options="pickerOptions"
- @change="endTimeChange"
- :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 drugTypeList"
- :key="item.value"
- :label="item.name"
- :value="item.value">
- </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" @click="toPrint">打印</el-button>
- <el-button type="primary" @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">
- <template slot-scope="scope">
- {{getDrugTypeName(scope.row.drug_type)}}
- </template>
- </el-table-column>
- <el-table-column label="药品别名" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_alias}}
- </template>
- </el-table-column>
- <el-table-column label="药品名称" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_name}}
- </template>
- </el-table-column>
- <el-table-column label="规格&单位" align="center">
- <template slot-scope="scope">
- {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_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">
- <template slot-scope="scope">
- {{ scope.row.min_unit }}
- </template>
- </el-table-column>
- <el-table-column label="期初结余" align="center">
-
- <el-table-column prop="drugIn" label="数量" width="100" align="center">
-
- </el-table-column>
-
- <el-table-column prop="drugInMoney" label="进货金额" width="100" align="center">
-
- </el-table-column>
- <el-table-column prop="drugSaleMoney" label="销售金额" width="100" align="center">
-
- </el-table-column>
-
- </el-table-column>
- <el-table-column label="本期增加" align="center">
-
- <el-table-column prop="drugAdd" label="数量" width="100" align="center">
-
- </el-table-column>
-
- <el-table-column prop="drugAddPrice" label="进货金额" width="100" align="center">
-
- </el-table-column>
- <el-table-column prop="drugAddSalePrice" label="销售金额" width="100" align="center">
- </el-table-column>
-
- </el-table-column>
-
- <el-table-column label="本期减少" align="center">
- <el-table-column prop="drugOut" label="数量" width="100" align="center">
- </el-table-column>
- <el-table-column prop="drugOutPrice" label="进货金额" width="100" align="center">
- </el-table-column>
- <el-table-column prop="drugOutSalePrice" label="销售金额" width="100" align="center">
- </el-table-column>
- </el-table-column>
-
- <el-table-column label="期末结余" align="center">
- <el-table-column prop="overDrug" label="数量" width="100" align="center">
- </el-table-column>
- <el-table-column prop="overDrugPrice" label="进货金额" width="100" align="center">
- </el-table-column>
- <el-table-column prop="oveDrugSaleMoney" label="销售金额" width="100" align="center">
- </el-table-column>
- </el-table-column>
-
-
- </el-table>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100,200,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,getPurchaseDrugQueryList,getDrugOverCount } from "@/api/drug/drug"
- const moment = require('moment')
- import { uParseTime } from '@/utils/tools'
- 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:"",
- drugTypeList:[],
- 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.drugTypeList = []
- 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
-
- 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,
- }
- getPurchaseDrugQueryList(params).then(response=>{
- if(response.data.state == 1){
- this.loading = false
- var list = response.data.data.list
- for (let i = 0; i < list.length; i++) {
-
- //期初结余入库
- if(list[i].DrugWarehouseInfoStart!=null && list[i].DrugWarehouseInfoStart.length > 0){
- for(let j=0;j<list[i].DrugWarehouseInfoStart.length;j++){
- if(list[i].max_unit == list[i].DrugWarehouseInfoStart[j].max_unit){
- list[i].DrugWarehouseInfoStart[j].count =list[i].min_number * list[i].DrugWarehouseInfoStart[j].count
- }
- }
- }
-
- //期初结余出库
- if(list[i].DrugWarehouseOutInfoStart!=null && list[i].DrugWarehouseOutInfoStart.length>0){
- for(let j=0;j<list[i].DrugWarehouseOutInfoStart.length;j++){
- if(list[i].max_unit == list[i].DrugWarehouseOutInfoStart[j].max_unit){
- list[i].DrugWarehouseOutInfoStart[j].count = list[i].DrugWarehouseOutInfoStart[j].count*list[i].min_number
- }
- }
- }
-
- //期初结余退库
- if(list[i].WareStartStockCancelInfo!=null && list[i].WareStartStockCancelInfo.length>0){
- for(let j=0;j<list[i].WareStartStockCancelInfo.length;j++){
- if(list[i].max_unit == list[i].WareStartStockCancelInfo[j].max_unit){
- list[i].WareStartStockCancelInfo[j].count = list[i].WareStartStockCancelInfo[j].count*list[i].min_number
- }
- }
- }
-
-
- //期末结余入库
- if(list[i].DrugWarehouseInfoEnd!=null && list[i].DrugWarehouseInfoEnd.length > 0){
- for(let j=0;j<list[i].DrugWarehouseInfoEnd.length;j++){
- if(list[i].max_unit == list[i].DrugWarehouseInfoEnd[j].max_unit){
- list[i].DrugWarehouseInfoEnd[j].count = list[i].min_number * list[i].DrugWarehouseInfoEnd[j].count
- }
- }
- }
-
- //期末结余出库
- if(list[i].DrugWarehouseOutInfoEnd!=null && list[i].DrugWarehouseOutInfoEnd.length>0){
- for(let j=0;j<list[i].DrugWarehouseOutInfoEnd.length;j++){
- if(list[i].max_unit == list[i].DrugWarehouseOutInfoEnd[j].max_unit){
- list[i].DrugWarehouseOutInfoEnd[j].count = list[i].DrugWarehouseOutInfoEnd[j].count*list[i].min_number
- }
- }
- }
-
- //期末结余退库
- if(list[i].WareEndStockCancelInfo!=null && list[i].WareEndStockCancelInfo.length>0){
- for(let j=0;j<list[i].WareEndStockCancelInfo.length;j++){
- if(list[i].max_unit == list[i].WareEndStockCancelInfo[j].max_unit){
- list[i].WareEndStockCancelInfo[j].count = list[i].WareEndStockCancelInfo[j].count*list[i].min_number
- }
- }
- }
-
- //期中增加
- if(list[i].DrugWarehouseInfoStartEnd!=null && list[i].DrugWarehouseInfoStartEnd.length > 0){
- for(let j=0;j<list[i].DrugWarehouseInfoStartEnd.length;j++){
- if(list[i].max_unit == list[i].DrugWarehouseInfoStartEnd[j].max_unit){
- list[i].DrugWarehouseInfoStartEnd[j].count =list[i].min_number * list[i].DrugWarehouseInfoStartEnd[j].count
- }
- }
- }
-
- //期中减少
- if(list[i].DrugWarehouseOutInfoStartEnd!=null && list[i].DrugWarehouseOutInfoStartEnd.length > 0){
- for(let j=0;j<list[i].DrugWarehouseOutInfoStartEnd.length;j++){
- if(list[i].max_unit == list[i].DrugWarehouseOutInfoStartEnd[j].max_unit){
- list[i].DrugWarehouseOutInfoStartEnd[j].count =list[i].min_number * list[i].DrugWarehouseOutInfoStartEnd[j].count
- }
- }
- }
-
- //期中退库
- if(list[i].WareStartEndStockCancelInfo!=null && list[i].WareStartEndStockCancelInfo.length > 0){
- for(let j=0;j<list[i].WareStartEndStockCancelInfo.length;j++){
- if(list[i].max_unit == list[i].WareStartEndStockCancelInfo[j].max_unit){
- list[i].WareStartEndStockCancelInfo[j].count =list[i].min_number * list[i].WareStartEndStockCancelInfo[j].count
- }
- }
- }
-
-
-
- //期初盘盈
- if(list[i].WareStartStockInventoryProfit!=null && list[i].WareStartStockInventoryProfit.length > 0){
- for(let j=0;j<list[i].WareStartStockInventoryProfit.length;j++){
- if(list[i].max_unit == list[i].WareStartStockInventoryProfit[j].max_unit){
- list[i].WareStartStockInventoryProfit[j].count = list[i].WareStartStockInventoryProfit[j].count * list[i].min_number
- }
- }
- }
-
- //期初盘亏
- if(list[i].WareStartStockInventoryLosses!=null && list[i].WareStartStockInventoryLosses.length > 0){
- for(let j=0;j<list[i].WareStartStockInventoryLosses.length;j++){
- if(list[i].max_unit == list[i].WareStartStockInventoryLosses[j].max_unit){
- list[i].WareStartStockInventoryLosses.count = list[i].WareStartStockInventoryLosses[j].count * list[i].min_number
- }
- }
- }
-
-
-
- //期中盘盈
- if(list[i].WareStartEndStockInventoryProfit!=null && list[i].WareStartEndStockInventoryProfit.length > 0){
- for(let j=0;j<list[i].WareStartEndStockInventoryProfit.length;j++){
- if(list[i].max_unit == list[i].WareStartEndStockInventoryProfit[j].max_unit){
- list[i].WareStartEndStockInventoryProfit[j].count = list[i].WareStartEndStockInventoryProfit[j].count * list[i].min_number
- }
- }
- }
-
- //期中盘亏
- if(list[i].WareStartEndStockInventoryLosses!=null && list[i].WareStartEndStockInventoryLosses.length > 0){
- for(let j=0;j<list[i].WareStartEndStockInventoryLosses.length;j++){
- if(list[i].max_unit == list[i].WareStartEndStockInventoryLosses[j].max_unit){
- list[i].WareStartEndStockInventoryLosses[j].count = list[i].WareStartEndStockInventoryLosses[j].count * list[i].min_number
- }
- }
- }
- //期末盘盈
- if(list[i].WareEndStockInventoryProfit!=null && list[i].WareEndStockInventoryProfit.length >0){
- for(let j=0;j<list[i].WareEndStockInventoryProfit.length;j++){
- if(list[i].max_unit == list[i].WareEndStockInventoryProfit[j].max_unit){
- list[i].WareEndStockInventoryProfit[j].count = list[i].WareEndStockInventoryProfit[j].count * list[i].min_number
- }
- }
- }
- //期末盘亏
- if(list[i].WareEndStockInventoryLosses!=null && list[i].WareEndStockInventoryLosses.length > 0){
- for(let j=0;j<list[i].WareEndStockInventoryLosses.length;j++){
- if(list[i].max_unit == list[i].WareEndStockInventoryLosses[j].max_unit){
- list[i].WareEndStockInventoryLosses[j].count = list[i].WareEndStockInventoryLosses[j].count * list[i].min_number
- }
- }
- }
- }
-
- console.log("list23323223322332232323322323wode",list)
- for(let i=0;i<list.length;i++){
- list[i].last_price_in = 0
- list[i].drugAddOne= 0
- list[i].drugOutOne =0
- list[i].drugIn = this.GetDrugStartFlow(list[i].DrugStatFlow.over_count,list[i].min_number,list[i].min_unit,list[i].max_unit)
-
-
- list[i].drugInMoney = list[i].last_price
- list[i].drugSaleMoney = (list[i].drugIn * list[i].drugInMoney).toFixed(2)
-
- list[i].drugAdd = this.drugAddInfo(list[i].DrugWarehouseInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryProfit)
- list[i].drugAddOne = this.drugAddInfoOne(list[i].DrugWarehouseInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryProfit)
-
- if(this.org_id == 0 || this.org_id == 10644){
- list[i].drugAddPrice = ""
- list[i].drugAddSalePrice = this.drugAddInfoOnePirce(list[i].DrugWarehouseInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryProfit)
- }else{
- list[i].drugAddPrice = list[i].last_price
- list[i].drugAddSalePrice = (list[i].drugAdd * list[i].drugAddPrice).toFixed(2)
- }
-
-
-
-
-
- list[i].drugOut= this.getDrugOut(list[i].DrugWarehouseOutInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryLosses,list[i].WareStartEndStockCancelInfo)
- list[i].drugOutOne =this.getDrugOutOne(list[i].DrugWarehouseOutInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryLosses,list[i].WareStartEndStockCancelInfo)
-
- list[i].drugOutPrice = list[i].min_price
- list[i].drugOutSalePrice = (list[i].drugOut*list[i].drugOutPrice).toFixed(2)
-
-
-
- list[i].overDrug = this.GetDrugOver(list[i].DrugStatFlow.over_count,list[i].drugAddOne,list[i].drugOutOne,list[i].min_number,list[i].min_unit,list[i].max_unit)
-
-
- list[i].overDrugPrice = list[i].last_price
- list[i].oveDrugSaleMoney = (list[i].overDrug * list[i].overDrugPrice).toFixed(2)
- }
- this.tableList = list;
- this.total = response.data.data.total
- this.manufacturerList = response.data.data.manufacturerList
- var drugTypeList = response.data.data.drugTypeList
- var obj = {value:0,name:"全部"}
- this.drugTypeList.push(obj)
- for(let i=0;i<drugTypeList.length;i++){
- this.drugTypeList.push(drugTypeList[i])
- }
-
- }
- })
- },
- 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.drugTypeList = []
- this.limit = val;
- this.getlist()
- },
- handleCurrentChange(val) {
- this.page = val;
- this.drugTypeList = []
- this.getlist()
- },
- seach(){
- this.drugTypeList = []
- this.houseList= []
- this.getlist()
- },
- getDrugTypeName(id){
- var type_name = ""
- for(let i=0;i<this.drugTypeList.length;i++){
- if(id == this.drugTypeList[i].value){
- type_name = this.drugTypeList[i].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
- },
- 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.drugTypeList = []
- this.getlist()
- },
- startTimeChange(){
- this.drugTypeList = []
- this.getlist()
- },
- getDrugWarehouseInfoOne(arr,min_number,min_unit,max_unit,arr2,arr3,arr4,arr5){
- var total = 0
- var totalOne =0
- var totalTwo = 0
- var totalthree= 0
- var totalfour = 0
- var totalfive = 0
- var max_str = "";
- var min_str = "";
- if(arr!=null && arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalOne += arr[i].count
- }
- }
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- totalTwo += arr2[i].count
- }
- }
- if(arr3!=null && arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- totalthree += arr3[i].count
- }
- }
- if(arr4!=null && arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- totalfour += arr4[i].count
- }
- }
-
- if(arr5!=null && arr5.length > 0){
- for(let i=0;i<arr5.length;i++){
- totalfive += arr5[i].count
- }
- }
- // console.log("totalONE223323232323232",totalOne)
- // console.log("totalTwo2oo2o32o3o32o23",totalTwo)
- // console.log("totalfive",totalfive)
- // console.log("00-------------------------")
- total = totalOne - totalTwo + totalthree - totalfour + totalfive
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- console.log("max_str",max_str)
- console.log("min_str",min_str)
- if(max_str == "" && min_str == ""){
- return "0"
- }else{
- return max_str + min_str
- }
-
-
- },
- getDrugWarehouseInfo(arr,arr4,min_number,min_unit,max_unit,arr2,arr3,arr5){
- var total = 0
- var total_one= 0
- var total_two = 0
- var total_three = 0
- var total_four = 0
- var total_five = 0
- var max_str = "";
- var min_str = "";
- if(arr!=null && arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_one += arr[i].count
- }
- }
- if(arr4!=null && arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- total_four += arr4[i].count
- }
- }
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- total_two+= arr2[i].count
- }
- }
- if(arr3!=null && arr3.length >0){
- for(let i=0;i<arr3.length;i++){
- total_three +=arr3[i].count
- }
- }
-
- if(arr5!=null && arr5.length >0){
- for(let i=0;i<arr5.length;i++){
- total_five +=arr5[i].count
- }
- }
-
- total = total_one - total_four +total_two - total_three + total_five
- if(total < 0){
- total = 0
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- if(max_str == "" && min_str == ""){
- return "0"
- }else{
- return max_str + min_str;
- }
-
- },
- getDrugWarehouseInfoStart(arr,min_number,min_unit,max_unit,outArr){
- var total = 0
- var add_total = 0
- var out_total = 0
- var max_str = "";
- var min_str = "";
- if(arr!=null &&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- add_total += arr[i].warehousing_count
- }
- }
- if(outArr.length > 0){
- for(let i=0;i<outArr.length;i++){
- out_total+= outArr[i].count
- }
- }
- total = add_total - out_total
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
-
- },
- getDrugWarehouseInfoMoneyStart(arr,min_number,min_unit,max_unit,last_price,outArr){
- var total = 0
- var min_str = 0
- var max_str = 0
- var addTotal = 0
- var outTotal = 0
- var total_price = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- addTotal += arr[i].warehousing_count
- }
- }
- if(outArr.length > 0){
- for(let i=0;i<outArr.length;i++){
- outTotal += outArr[i].count
- }
- }
-
- total = addTotal - outTotal
- if (total < min_number) {
- min_str = total
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number);
- }
- if (total % min_number != 0) {
- min_str = (total % min_number);
- }
- }
-
- total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
-
- return total_price
- },
- getDrugWarehouseInfoMoney(arr,min_number,min_unit,max_unit,last_price){
- var total = 0
- var min_str = 0
- var max_str = 0
- var total_price = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].stock_max_number + arr[i].stock_min_number
- }
- }
- if (total < min_number) {
- min_str = total
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number);
- }
- if (total % min_number != 0) {
- min_str = (total % min_number);
- }
- }
-
- total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
-
- return total_price
- },
- getDrugWarehouseInfoStockAdd(arr,min_number,min_unit,max_unit){
-
- var total = 0
- var max_str = "";
- var min_str = "";
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].warehousing_count
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getDrugWarehouseInfoaddMoney(arr,min_number,min_unit,max_unit,last_price){
- var total = 0
- var min_str = 0
- var max_str = 0
- var total_price = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].warehousing_count
- }
- }
- if (total < min_number) {
- min_str = total
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number);
- }
- if (total % min_number != 0) {
- min_str = (total % min_number);
- }
- }
-
- total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
- return total_price
- },
- getDrugInMoneyOne(arr,min_number,min_unit,max_unit,arr2,arr3,arr4,arr5){
-
- var totalOne = 0
- var totalTwo =0
- var total_three = 0
- var total_four = 0
- var totalFive = 0
- var total_price = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalOne += (arr[i].count/min_number*arr[i].price) + arr[i].count*(arr[i].price%min_number)
- }
- }
-
- if(arr2!=null&&arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- totalTwo += ((arr2[i].count/min_number) * arr2[i].price) + ((arr2[i].count%min_number)*(arr2[i].price/min_number))
- }
- }
-
-
- if(arr3!=null&&arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- total_three+=arr3[i].count* arr3[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr4!=null&&arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- total_four+=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr5!=null&&arr5.length > 0){
- for(let i=0;i<arr5.length;i++){
- totalFive += ((arr5[i].count/min_number) * arr5[i].price) + ((arr5[i].count%min_number)*(arr5[i].price/min_number))
- }
- }
-
- total_price =(totalOne - totalTwo + total_three - total_four + totalFive).toFixed(2)
-
- if(total_price >0){
- return total_price
- }else{
- return "0.00"
- }
-
- },
- getDrugInMoney(arr,arr4,min_number,min_unit,max_unit,arr2,arr3,arr5){
-
- var total_price = 0
- var total_one_price = 0
- var total_two_price = 0
- var total_four_price =0
- var total_three_price = 0
- var total_five_price = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_one_price += arr[i].count * (arr[i].price/min_number) + arr[i].count * (arr[i].price%min_number)
- }
- }
-
- if(arr4!=null && arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- // total_four_price +=arr4[i].count * arr4[i].xt_drug_warehouse_info.price/min_number
- total_four_price+= ((arr4[i].count/min_number) * arr4[i].price) + ((arr4[i].count%min_number)*(arr4[i].price/min_number))
- }
- }
-
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- total_two_price += arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
- }
- }
-
- if(arr3!=null && arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- total_three_price += arr3[i].count * arr3[i].xt_drug_warehouse_info.price/min_number
- }
- }
-
- if(arr5!=null && arr5.length > 0){
- for(let i=0;i<arr5.length;i++){
- total_five_price += arr5[i].count * arr5[i].xt_drug_warehouse_info.price/min_number
- }
- }
-
- total_price = total_one_price - total_four_price + total_two_price - total_three_price + total_five_price
- if(total_price > 0){
- return total_price.toFixed(2)
- }else{
- return "0.00"
- }
- },
- getSaleMoney(arr,arr4,min_number,min_unit,max_unit,arr2,arr3,arr5){
-
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var total_price_four = 0
- var total_price_three =0
- var total_price_five = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_price_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
- }
- }
- if(arr4!=null && arr4.length>0){
- for(let i=0;i<arr4.length > 0;i++){
- total_price_four += arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
- }
- }
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- total_price_two += arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
- }
-
- }
-
- if(arr3!=null && arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- total_price_three += arr3[i].count * arr3[i].xt_drug_warehouse_info.retail_price
- }
-
- }
-
- if(arr5!=null && arr5.length > 0){
- for(let i=0;i<arr5.length;i++){
- total_price_five += arr5[i].count * arr5[i].xt_drug_warehouse_info.retail_price
- }
-
- }
-
- total_price = total_price_one - total_price_four + total_price_two - total_price_three + total_price_five
- if(total_price >0){
- return total_price.toFixed(2)
- }else{
- return "0.00"
- }
-
- },
- getSaleMoneyOne(arr,min_number,min_unit,max_unit,arr2,arr3,arr4,arr5){
- var totalOne = 0
- var totalTwo =0
- var total_price = 0
- var total_three= 0
- var total_four = 0
- var total_five = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalOne += arr[i].count*arr[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr2!=null&&arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- totalTwo += arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr3!=null&&arr3.length > 0){
- for(let i=0;i<arr3.length;i++){
- total_three+=arr3[i].count* arr3[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr4!=null&&arr4.length > 0){
- for(let i=0;i<arr4.length;i++){
- total_four+=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr5!=null&&arr5.length > 0){
- for(let i=0;i<arr5.length;i++){
- total_five+=arr5[i].count * arr5[i].xt_drug_warehouse_info.retail_price
- }
- }
- // console.log("total_one",totalOne)
- // console.log("totalTwo",totalTwo)
- // console.log("total_three",total_three)
- // console.log("total_four",total_four)
-
- // console.log("total_pricewode",(totalOne - totalTwo+total_three - total_four).toFixed(2))
- total_price =(totalOne - totalTwo+total_three - total_four + total_five).toFixed(2)
- if(total_price > 0){
- return total_price
- }else{
- return "0.00"
- }
-
- },
- getDrugWarehouseOutInfo(arr,min_number,min_unit,max_unit){
- var total = 0
- var max_str = "";
- var min_str = "";
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].count
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getDrugWarehouseOutMoney(arr,min_number,min_unit,max_unit,last_price){
- var total = 0
- var min_str = 0
- var max_str = 0
- var total_price = 0
- if(arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total += arr[i].count
- }
- }
- if (total < min_number) {
- min_str = total
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number);
- }
- if (total % min_number != 0) {
- min_str = (total % min_number);
- }
- total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
- return total_price
- }
- },
- 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.drugTypeList = []
- this.getStorehouseList()
- this.getlist()
- },
-
- drugAddInfo(arr,min_number,min_unit,max_unit,arr2){
- var total = 0
- var totalone = 0
- var totaltwo = 0
- var max_str = "";
- var min_str = "";
- if(arr!=null && arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalone += arr[i].count
- }
- }
- if(arr2!=null && arr2.length >0){
- for(let i=0;i<arr2.length;i++){
- totaltwo += arr2[i].count
- }
- }
- total = totalone + totaltwo
-
-
- return total
-
- },
- drugAddInfoOne(arr,min_number,min_unit,max_unit,arr2){
- var total = 0
- var totalone = 0
- var totaltwo = 0
- if(arr!=null && arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalone += arr[i].count
- }
- }
- if(arr2!=null && arr2.length >0){
- for(let i=0;i<arr2.length;i++){
- totaltwo += arr2[i].count
- }
- }
- total = totalone + totaltwo
-
-
- return total
-
- },
- drugAddInfoOnePirce(arr,min_number,min_unit,max_unit,arr2){
- console.log("arr----------------",arr)
- console.log("newArr----------------",arr2)
- var total = 0
- var totalone_price = 0
- var total_two_price = 0
- if(arr!=null && arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalone_price += arr[i].count * arr[i].price
- }
- }
- if(arr2!=null && arr2.length >0){
- for(let i=0;i<arr2.length;i++){
- total_two_price += arr2[i].count * arr[i].price
- }
- }
- total = totalone_price + total_two_price
-
-
- return total
- },
- getdrugAddPrice(arr,min_number,min_unit,max_unit,arr2){
- var total = 0
- var totalone =0
- var totaltwo = 0
- var total_price = 0
-
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalone += arr[i].count * arr[i].xt_drug_warehouse_info.price/min_number
- }
- }
-
- if(arr2!=null && arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- totaltwo +=arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
- }
- }
- total = totalone + totaltwo
- total_price =total.toFixed(2)
- return total_price
- },
- drugAddSalePrice(arr,min_number,min_unit,max_unit,arr2){
- var total = 0
- var total_one = 0
- var total_two = 0
- var total_price = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr2!=null&&arr2.length > 0){
- for(let i=0;i<arr2.length;i++){
- total_two +=arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- total = total_one + total_two
-
- total_price = total.toFixed(2)
- return total_price
- },
- getDrugOut(arr,min_number,min_unit,max_unit,arr2,arr3){
- var total = 0
- var totalone = 0
- var totaltwo = 0
- var totalthree = 0
- var min_str = ""
- var max_str = ""
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalone +=arr[i].count
- }
- }
- if(arr2!=null && arr2.length>0){
- for(let i=0;i<arr2.length;i++){
- totaltwo +=arr2[i].count
- }
- }
- if(arr3!=null && arr3.length>0){
- for(let i=0;i<arr3.length;i++){
- totalthree +=arr3[i].count
- }
- }
-
- total = totalone + totaltwo - totalthree
-
- return total
-
- },
- getDrugOutOne(arr,min_number,min_unit,max_unit,arr2,arr3){
- var total = 0
- var totalone = 0
- var totaltwo = 0
- var totalthree = 0
- var min_str = ""
- var max_str = ""
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- totalone +=arr[i].count
- }
- }
- if(arr2!=null && arr2.length>0){
- for(let i=0;i<arr2.length;i++){
- totaltwo +=arr2[i].count
- }
- }
- if(arr3!=null && arr3.length>0){
- for(let i=0;i<arr3.length;i++){
- totalthree +=arr3[i].count
- }
- }
- total = totalone + totaltwo - totalthree
-
- return total
-
- },
- getDrugOutPrice(arr,min_number,min_unit,max_unit,arr2,arr3){
-
- var total_price = 0
- var total_one_price =0
- var total_two_price = 0
- var total_three_price = 0
- var total = 0
- var total_two = 0
- var total_three = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_one_price += arr[i].count * (arr[i].xt_drug_warehouse_info.price/min_number)
- total += arr[i].count
- }
- }
- if(arr2!=null && arr2.length>0){
- for(let i=0;i<arr2.length;i++){
- total_two_price +=arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
- total_two +=arr2[i].count
- }
- }
-
- if(arr3!=null && arr3.length>0){
- for(let i=0;i<arr3.length;i++){
- total_three_price +=arr3[i].count * arr3[i].xt_drug_warehouse_info.price/min_number
- total_three +=arr3[i].count
- }
- }
-
- total_price = total_one_price + total_two_price - total_three_price
- if(total_price > 0){
- return total_price.toFixed(2)
- }else{
- return "0.00"
- }
-
- },
- getDrugOutSaleprice(arr,min_number,min_unit,max_unit,arr3,arr4){
- var total_price = 0
- var total_price_one = 0
- var total_price_two = 0
- var total_price_three = 0
- if(arr!=null&&arr.length > 0){
- for(let i=0;i<arr.length;i++){
- total_price_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr3!=null && arr3.length >0){
- for(let i=0;i<arr3.length;i++){
- total_price_two +=arr3[i].count * arr3[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- if(arr4!=null && arr4.length >0){
- for(let i=0;i<arr4.length;i++){
- total_price_three +=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
- }
- }
-
- total_price = total_price_one + total_price_two - total_price_three
-
- if(total_price > 0){
- return total_price.toFixed(2)
- }else{
- return "0.00"
- }
-
- },
- toPrint(){
- this.$router.push({path:"/drugs/purchase/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() {
-
- 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.getDrugTypeName(this.tableList[i].drug_type)
- 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 = this.tableList[i].dose + this.tableList[i].dose_unit +"*"+this.tableList[i].min_number + this.tableList[i].min_unit+"/"+this.tableList[i].max_unit
-
- // this.tableList[i].drugInMoney = this.tableList[i].last_price
-
- }
- 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:I2', 'J1:L1', 'M1:O1', 'P1:R1','S1:U1']
- const filterVal = ['index', 'query_date', 'good_type','drug_alias','drug_name','specification_name','manufacturer_name','dealer_name','min_unit','drugIn','drugInMoney','drugSaleMoney','drugAdd','drugAddPrice','drugAddSalePrice','drugOut','drugOutPrice','drugOutSalePrice','overDrug','overDrugPrice','oveDrugSaleMoney']
-
- 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]));
- },
- GetDrugStartFlow(total,min_number,min_unit,max_unit){
- // var min_str = ""
- // var max_str = ""
- // if (total < min_number) {
- // min_str = total + min_unit;
- // }
- // if (total == 0) {
- // min_str = "";
- // max_str = "";
- // }
- // if (total >= min_number) {
- // if (parseInt(total / min_number) != 0) {
- // max_str = parseInt(total / min_number) + max_unit;
- // }
- // if (total % min_number != 0) {
- // min_str = (total % min_number) + min_unit;
- // }
- // }
- // if(max_str == "" && min_str == ""){
- // return "0"
- // }else{
- // return max_str + min_str;
- // }
- return total
- },
-
-
- GetDrugEndFlow(total,min_number,min_unit,max_unit){
-
- var min_str = ""
- var max_str = ""
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- if(max_str == "" && min_str == ""){
- return "0"
- }else{
- return max_str + min_str;
- }
- },
- toOverCount(){
- getDrugOverCount().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
- },
- GetDrugOver(totalone,totaltwo,totalthree,min_number,min_unit,max_unit){
- var total = 0
-
- total = totalone + totaltwo - totalthree
- return total
- }
- }
- }
- </script>
-
|