Skip to content

Commit

Permalink
Merge pull request #3759 from mikhailprivalov/download-one-price-xlsx
Browse files Browse the repository at this point in the history
Цены по прайсу - xlsx форма
  • Loading branch information
urchinpro authored Apr 26, 2024
2 parents e322536 + 20eddb3 commit 979410c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion forms/forms114.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import datetime
from openpyxl import Workbook

from contracts.models import PriceName
from forms.sql_func import get_researches, get_coasts, get_prices


def form_01(request_data) -> Workbook:
price_id = request_data.get("priceId")
work_book = Workbook()
work_sheet = work_book[work_book.sheetnames[0]]

current_day = datetime.datetime.now()
researches = get_researches()
prices = get_prices(current_day)
if price_id and price_id != 'null':
prices = PriceName.objects.filter(pk=price_id)
else:
prices = get_prices(current_day)
price_template = {price.id: 0 for price in prices}
price_ids = tuple(price_template.keys())
price_titles = [f"{price.title}-{price.symbol_code}" for price in prices]
Expand Down
13 changes: 10 additions & 3 deletions l2-frontend/src/construct/ConstructPrice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<a

Check warning on line 18 in l2-frontend/src/construct/ConstructPrice.vue

View workflow job for this annotation

GitHub Actions / webpack_build_prod

Expected indentation of 6 spaces but found 7 spaces

Check warning on line 18 in l2-frontend/src/construct/ConstructPrice.vue

View workflow job for this annotation

GitHub Actions / webpack_build_prod

Expected indentation of 6 spaces but found 7 spaces
class="a-under a-align margin-top margin-bottom"
href="#"
@click.prevent="downloadAllSpecificationTOXlsx"
@click.prevent="downloadCoastTOXlsx()"
>
XLSX
</a>
Expand Down Expand Up @@ -164,6 +164,13 @@
>
Cпецификация
</a>
<a
class="a-under a-align r-padding"
href="#"
@click.prevent="downloadCoastTOXlsx(selectedPrice)"
>
XLSX
</a>
<a
class="a-under a-align r-padding"
href="#"
Expand Down Expand Up @@ -461,8 +468,8 @@ export default {
downloadSpecification() {
window.open(`/forms/docx?type=102.03&priceId=${this.selectedPrice}`, '_blank');
},
downloadAllSpecificationTOXlsx() {
window.open('/forms/xlsx?type=114.01', '_blank');
downloadCoastTOXlsx(priceId = null) {
window.open(`/forms/xlsx?type=114.01&priceId=${priceId}`, '_blank');
},
async copyPrice() {
await this.$store.dispatch(actions.INC_LOADING);
Expand Down

0 comments on commit 979410c

Please sign in to comment.