Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
9a9a95816d

+ 48 - 14
src/xt_pages/stock/drugs/components/drugOutDetail.vue View File

@@ -212,6 +212,8 @@ export default {
212 212
   name: "stockOutDetail",
213 213
 
214 214
   created() {
215
+    this.org_id = this.$store.getters.xt_user.org.id
216
+    console.log("jj233223323223",this.org_id)
215 217
     var nowDate = new Date();
216 218
     var nowYear = nowDate.getFullYear();
217 219
     var nowMonth = nowDate.getMonth() + 1;
@@ -281,7 +283,8 @@ export default {
281 283
       tableData:[],
282 284
       tableList:[],
283 285
       drugList:[],
284
-      tablePrint:[]
286
+      tablePrint:[],
287
+      org_id:0,
285 288
     };
286 289
   },
287 290
   methods: {
@@ -452,7 +455,7 @@ export default {
452 455
                  count:0,
453 456
                  price:item.price,
454 457
                  remark:item.remark,
455
-                 total_price:0,
458
+                 total_price:0.0,
456 459
                  dose:item.dose,
457 460
                  dose_unit:item.dose_unit,
458 461
                  min_number:item.min_number,
@@ -507,23 +510,32 @@ export default {
507 510
         console.log("hh23233223",this.tablePrint)
508 511
         for(let i=0;i<this.tablePrint.length;i++){
509 512
           this.tablePrint[i].index = i+1
510
-          
511 513
         }
512 514
         for(let i=0;i<this.tablePrint.length;i++){
513
-           this.tablePrint[i].count = this.getCount(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_unit,this.tablePrint[i].min_number)
514
-           this.tablePrint[i].total_price = this.getTotalPrice(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].price)
515
-           this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
516
-            this.tablePrint[i].total = this.getTotalPriceOne(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].price) 
515
+           if(this.org_id == 9671 || this.org_id == 9919 ){
516
+             this.tablePrint[i].count = this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child)
517
+             this.tablePrint[i].total_price = this.getCountSenven(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)
518
+             this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
519
+             this.tablePrint[i].total = this.getCountSenvenOne(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)
520
+           }else{
521
+              this.tablePrint[i].count = this.getCount(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_unit,this.tablePrint[i].min_number)
522
+              this.tablePrint[i].total_price = this.getTotalPrice(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].price)
523
+              this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
524
+              this.tablePrint[i].total = this.getTotalPriceOne(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].price) 
525
+           }
526
+         
527
+          
517 528
         }
518 529
        console.log("列表数据333333333",this.tablePrint)
519
-     
530
+    
520 531
        import('@/vendor/Export2Excel').then(excel => {
521 532
        const tHeader = ['序号','药品名称', '规格型号', '单位','数量','单价','总价','备注']
522 533
        const filterVal = ['index','drug_name', 'unit', 'min_unit','count','price','total_price','remark']
523
-       let obj = {'index':'合计','total_price':0}
534
+       let obj = {'index':'合计','total_price':0.00}
524 535
        for(let i=0;i<this.tablePrint.length;i++){
525
-         obj.total_price += this.tablePrint[i].total 
536
+         obj.total_price += this.tablePrint[i].total
526 537
        }
538
+       obj.total_price = obj.total_price.toFixed(2)
527 539
        this.tablePrint.push(obj)
528 540
        const data = this.formatJson(filterVal, this.tablePrint)
529 541
        console.log("data",data)
@@ -561,9 +573,9 @@ export default {
561 573
         this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
562 574
         this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)
563 575
        }
564
-       let obj = {'index':'合计','total_price':0}
576
+       let obj = {'index':'合计','total_price':0.00}
565 577
        for(let i=0;i<this.tableData.length;i++){
566
-         obj.total_price += this.tableData[i].total 
578
+         obj.total_price += this.tableData[i].total
567 579
        }
568 580
        
569 581
        this.tableData.push(obj)
@@ -628,7 +640,7 @@ export default {
628 640
                   drug_spec:item.XtBaseDrug.drug_spec,
629 641
                   min_unit:item.XtBaseDrug.min_unit,
630 642
                   count:0,
631
-                  price:item.XtBaseDrug.min_price,
643
+                  price:item.XtBaseDrug.last_price,
632 644
                   remark:item.XtBaseDrug.remark,
633 645
                   total_price:"",
634 646
                   dose:item.XtBaseDrug.dose,
@@ -709,7 +721,29 @@ export default {
709 721
         }
710 722
         console.log("total23232",total)
711 723
         return total*min_price
712
-      }
724
+      },
725
+      getCountSix(drug_id,val){
726
+        console.log("val233232",val)
727
+        var count = 0 
728
+        for(let i=0;i<val.length;i++){
729
+          count+= val[i].count
730
+        }
731
+        return count
732
+      },
733
+      getCountSenven(drug_id,val,price){
734
+        var count = 0 
735
+        for(let i=0;i<val.length;i++){
736
+          count+= val[i].count
737
+        }
738
+        return (count*price).toFixed(2)
739
+      },
740
+      getCountSenvenOne(drug_id,val,price){
741
+        var count = 0 
742
+        for(let i=0;i<val.length;i++){
743
+          count+= val[i].count
744
+        }
745
+        return (count*price)
746
+      },
713 747
   }
714 748
 };
715 749
 </script>

+ 27 - 75
src/xt_pages/stock/drugs/drugOutOrderPrint.vue View File

@@ -37,23 +37,21 @@
37 37
                 <span>{{item.dose}}{{item.dose_unit}}*{{item.min_number}}{{item.min_unit}}/{{item.max_unit}}</span>
38 38
               </td>
39 39
               <td style="line-height: 50px">
40
-                <span>{{item.min_unit}}</span>
40
+                <span v-if="org_id == 9671 || org_id == 9919 ">{{item.max_unit}}</span>
41
+                <span v-else>{{item.min_unit}}</span>
41 42
               </td>
42 43
             
43 44
               <td style="line-height: 50px">
44
-                  <!-- {{item.count}} -->
45
-                  {{getCount(item.child,item.max_unit,item.min_unit,item.min_number)}}
45
+                <span v-if="org_id == 9671 || org_id == 9919">{{getCountSix(item.drug_id,item.child)}}</span>  
46
+                <span v-else>{{getCount(item.child,item.max_unit,item.min_unit,item.min_number)}}</span>
46 47
               </td>
47 48
               <td style="line-height:50px">
48
-                  {{item.min_price}}
49
-                  <!-- {{getPrice(item.drug_id)}} -->
49
+                  <span v-if="org_id ==9671 || org_id == 9919">{{item.price}}</span>
50
+                  <span v-else>{{item.min_price}}</span> 
50 51
               </td>
51 52
               <td style="line-height:50px">
52
-                  <!-- {{(item.count * getPrice(item.drug_id)).toFixed(2)}} -->
53
-                  <!-- {{item.count*item.price}} -->
54
-                <!-- <span>{{getTotalPrice(item.child,item.max_unit,item.min_number,item.min_price)}}</span> -->
55
-               
56
-                <span>{{(getCountOne(item.child,item.max_unit,item.min_unit,item.min_number)*item.min_price).toFixed(2)}}</span>
53
+                <span v-if="org_id ==9671 || org_id == 9919">{{(getCountSenven(item.drug_id,item.child,item.price))}}</span>
54
+                <span v-else>{{(getCountOne(item.child,item.max_unit,item.min_unit,item.min_number)*item.min_price).toFixed(2)}}</span>
57 55
               </td>
58 56
               <td style="line-height: 50px">
59 57
                  {{item.remark}}
@@ -121,8 +119,8 @@
121 119
         limit:this.$route.query.limit,
122 120
         page:this.$route.query.page,
123 121
         cancelStockDate:[],
124
-        drugList:[]
125
-       
122
+        drugList:[],
123
+        org_id:0
126 124
       }
127 125
     },
128 126
     methods: {
@@ -163,67 +161,6 @@
163 161
         }
164 162
         return name
165 163
       },
166
-      // getlist(){
167
-      //   var params = {
168
-      //   start_time:this.start_time,
169
-      //   end_time:this.end_time,
170
-      //   order_type:this.order_type,
171
-      //   manufacturer_id:this.manufacturer_id,
172
-      //   keyword:this.searchKey,
173
-      //   limit:this.limit,
174
-      //   page:this.page,
175
-      //  }
176
-      //  console.log("出库数据22222",params)
177
-      // getDrugOutDetail(params).then(response=>{
178
-      //   if(response.data.state == 1){
179
-      //     var drugInOrder = response.data.data.order
180
-      //     console.log("出库数据22",drugInOrder)
181
-      //     let objInfo = {}
182
-      //     drugInOrder.forEach((item,index)=>{
183
-      //        let { drug_id } = item
184
-      //        if(!objInfo[drug_id]){
185
-      //          objInfo[drug_id] = {
186
-      //            drug_id,
187
-      //            child:[],
188
-      //            drug_name:item.drug_name,
189
-      //            drug_spec:item.drug_spec,
190
-      //            min_unit:item.min_unit,
191
-      //            count:0,
192
-      //            last_price:item.XtBaseDrug.last_price,
193
-      //            remark:item.remark,
194
-      //            total_price:"",
195
-      //            dose:item.dose,
196
-      //            dose_unit:item.dose_unit,
197
-      //            min_number:item.min_number,
198
-      //            max_unit:item.max_unit,
199
-                
200
-      //          }
201
-      //        }
202
-      //     })
203
-      //     let list = Object.values(objInfo);
204
-      //     console.log("list2334444",list)
205
-      //     for(let i=0;i<drugInOrder.length;i++){
206
-      //       list.map(item=>{
207
-      //         if(drugInOrder[i].drug_id == item.drug_id){
208
-      //            item.child.push(drugInOrder[i])
209
-      //         }
210
-      //       })
211
-      //     }
212
-          
213
-      //     console.log("药品出库明细",list)
214
-      //     for(let i=0;i<list.length;i++){
215
-      //       for(let j=0;j<list[i].child.length;j++){
216
-      //         if(list[i].child[j].count!=null || list[i].child[j].count != "" || list[i].child[j].count!=0){
217
-      //           list[i].count += list[i].child[j].count
218
-      //         }
219
-      //       }
220
-      //     }
221
-      //     console.log("药品出库明细",list)
222
-      //     this.cancelStockDate = list
223
-        
224
-      //   }
225
-      // })  
226
-      // },
227 164
       getTotal(){
228 165
          var total = 0
229 166
          for(let i=0;i<this.cancelStockDate.length;i++){
@@ -312,7 +249,6 @@
312 249
         })
313 250
       },
314 251
       getCount(arr,max_unit,min_unit,min_number){
315
-        console.log("arr2332332233232",arr)
316 252
         var total = 0
317 253
         var str = ""
318 254
         var min_str = ""
@@ -328,7 +264,6 @@
328 264
         for(let i=0;i<arr.length;i++){
329 265
           total+= parseInt(arr[i].total_count)
330 266
         }
331
-       console.log("total233223232323",total,min_number)
332 267
        if(total<min_number){
333 268
            str = ""
334 269
            min_str = total + min_unit
@@ -379,9 +314,26 @@
379 314
         }
380 315
         console.log("totla",total)
381 316
         return (total*min_price).toFixed(2)
317
+      },
318
+      getCountSix(drug_id,val){
319
+        console.log("val233232",val)
320
+        var count = 0 
321
+        for(let i=0;i<val.length;i++){
322
+          count+= val[i].count
323
+        }
324
+        return count
325
+      },
326
+      getCountSenven(drug_id,val,price){
327
+        var count = 0 
328
+        for(let i=0;i<val.length;i++){
329
+          count+= val[i].count
330
+        }
331
+        return (count*price).toFixed(2)
382 332
       }
383 333
     },
384 334
     created() {
335
+      this.org_id = this.$store.getters.xt_user.org.id
336
+      console.log("jj233223323223",this.org_id)
385 337
       var xtuser = this.$store.getters.xt_user
386 338
       this.orgname = xtuser.org.org_name
387 339
       this.getDrugOutOrderPrint()

+ 2 - 0
src/xt_pages/stock/drugs/drugStockInOrderEdit.vue View File

@@ -441,6 +441,7 @@ export default {
441 441
       drugList:[],
442 442
       manufacturerList:[],
443 443
       dealerList:[],
444
+      org_id:0,
444 445
     };
445 446
   },
446 447
   methods: {
@@ -869,6 +870,7 @@ export default {
869 870
 
870 871
   },
871 872
   created() {
873
+   
872 874
     this.drugTypeList = getDictionaryDataConfig('system','drug_type') 
873 875
     this.GetConfigInfo();
874 876
     this.propForm.goodUnit = this.$store.getters.good_unit;