def get(self, request, company_id:int, record:int) -> HttpResponse: html = cashaccept2pdf(record) if html: # create pdf file and save on templates/pdf/cashaccept_{record}.pdf filename = f'cashaccept_{record}.pdf' response = make_attachment(html, filename) return response else: messages.warning(request, r'Nothing to print...') return HttpResponseRedirect(reverse('cashregister:cash_register', args=[company_id]))
def post(self, request, **kwargs): '''convert html cashregister_pdf for selected cash register to pdf''' if self.html: # create cash register as pdf file attachment filename = f'cashregister_{self.company_id}_{self.year}_{self.month}.pdf' response = make_attachment(self.html, filename) return response else: messages.warning(self.request, r'Nothing to print...') return HttpResponseRedirect(reverse('cashregister:cash_register', args=[self.company_id]))
def get(self, request, employee_id:int, month:int, year:int): '''send a statement of advances as a pdf attachment to the browser''' html = accountpaymenthtml2pdf(employee_id, month, year) if html: # create pdf file filename = f'accountpayment_{employee_id}_{month}_{year}.pdf' response = make_attachment(html, filename) return response else: messages.warning(request, r'Nothing to print...') return HttpResponseRedirect(reverse('evidence:account_payment', args=[employee_id]))
def get(self, request, employee_id:int, month=None, year=None): '''send statement of workhours as pdf attachmnet on browser''' if month == None and year == None: month, year = now().month, now().year html = workhourshtml2pdf(employee_id, month, year) if html: # create pdf file filename = f'workhours_{employee_id}.pdf' response = make_attachment(html,filename) return response else: messages.warning(request, r'Nothing to print...') return HttpResponseRedirect(reverse('evidence:employee_complex_data_args', args=[employee_id, month, year]))