from django.http import JsonResponse from django.db.models import F from purchase.forms import (CreditPurchaseForm, CashPurchaseForm, CreditPurchaseReturnForm, CashPurchaseReturnForm) from work_data.views import (JSONCreateView, JSONUpdateView, JSONQueryView, JSONCreateMultipleView) from purchase.models import (CreditPurchase, CashPurchase, CreditPurchaseReturn, CashPurchaseReturn) from work_data.invoice import print_invoice from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required # This view loads in the app @method_decorator(access_required('cashpurchase'), name='dispatch') class AppInitP(generic.base.TemplateView): template_name = "purchase/cashpurchases.html" @method_decorator(access_required('creditpurchase'), name='dispatch') class AppInitPC(generic.base.TemplateView): template_name = "purchase/creditpurchases.html" @method_decorator(access_required('cashpr'), name='dispatch') class AppInitR(generic.base.TemplateView): template_name = "purchase/cashreturns.html" @method_decorator(access_required('creditpr'), name='dispatch')
import datetime from django.shortcuts import render from django.views import generic,View from django.http import JsonResponse from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required # These views loads in the apps @method_decorator(access_required('income'), name='dispatch') class AppIncome(LoginRequiredMixin,generic.base.TemplateView): template_name = 'accounting/income.html' @method_decorator(access_required('expenses'), name='dispatch') class AppExpenses(LoginRequiredMixin,generic.base.TemplateView): template_name = 'accounting/expenses.html'
from invoice.models import (SalesInvoice, SalesReturnInvoice, PurchaseInvoice, PurchaseReturnInvoice) from sales.models import CreditSale, CreditSalesReturn from purchase.models import CreditPurchase, CreditPurchaseReturn from django.core.exceptions import ObjectDoesNotExist import datetime from invoice.helpers import prepare_invoice_data from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required from cash.models import CashIncrement, CashDecrement, Cash from decimal import Decimal # This view loads in the app @method_decorator(access_required('invoice'), name='dispatch') class AppInit(LoginRequiredMixin, generic.base.TemplateView): template_name = 'invoice/index.html' # helpers class VoidInvoice(View): def post(self, request, *args, **kwargs): rpk = request.POST['id'] try: invoice = self.Invoice.objects.get(pk=rpk) invoice.status = '000' invoice.save() records = self.Record.objects.filter(invoice=rpk)
from receipt.forms import (SalesReceiptForm,SalesReturnReceiptForm, PurchaseReceiptForm,PurchaseReturnReceiptForm) from work_data.views import (JSONCreateView,JSONUpdateView,JSONQueryGet, JSONQueryView,JSONDeleteView) from receipt.models import (SalesReceipt,SalesReturnReceipt, PurchaseReceipt,PurchaseReturnReceipt) from sales.models import CashSale,CashSalesReturn from purchase.models import CashPurchase,CashPurchaseReturn from django.core.exceptions import ObjectDoesNotExist import datetime from .helpers import prepare_receipt_data from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required # This view loads in the app @method_decorator(access_required('receipt'), name='dispatch') class AppInit(LoginRequiredMixin,generic.base.TemplateView): template_name = 'receipt/index.html' # helpers class VoidReceipt(View): def post(self, request, *args, **kwargs): rpk = request.POST['id'] try: receipt = self.Receipt.objects.get(pk=rpk) receipt.status = '000' receipt.save() records = self.Record.objects.filter(receipt=rpk) for record in records:
from django.shortcuts import render from django.views import generic,View from django.http import JsonResponse from django.db.models import F from sales.forms import (CreditSaleForm,CashSaleForm, CreditSalesReturnForm,CashSalesReturnForm) from work_data.views import (JSONCreateView,JSONUpdateView, JSONQueryView,JSONCreateMultipleView) from sales.models import CreditSale,CashSale,CreditSalesReturn,CashSalesReturn from work_data.invoice import print_invoice from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required # This view loads in the app @method_decorator(access_required('cashsales'), name='dispatch') class AppInitS(generic.base.TemplateView): template_name="sales/cashsales.html" @method_decorator(access_required('creditsales'), name='dispatch') class AppInitSC(generic.base.TemplateView): template_name="sales/creditsales.html" @method_decorator(access_required('cashsr'), name='dispatch') class AppInitR(generic.base.TemplateView): template_name="sales/creditreturns.html" @method_decorator(access_required('creditsr'), name='dispatch') class AppInitRC(generic.base.TemplateView): template_name="sales/cashreturns.html" # helpers class SettleSale(View):
from django.http import JsonResponse from work_data.views import (JSONCreateView, JSONUpdateView, JSONQueryGet, JSONQueryView, JSONDeleteView) from sales.models import (CreditSale, CreditSalesReturn, CashSale, CashSalesReturn) from purchase.models import (CreditPurchase, CreditPurchaseReturn, CashPurchase, CashPurchaseReturn) from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required from logger.helpers import prepare_changes_data # These views loads in the apps @method_decorator(access_required('pc_logger'), name='dispatch') class AppInitPC(LoginRequiredMixin, generic.base.TemplateView): template_name = 'logger/pc_logger.html' @method_decorator(access_required('pr_logger'), name='dispatch') class AppInitPR(LoginRequiredMixin, generic.base.TemplateView): template_name = 'logger/pr_logger.html' @method_decorator(access_required('sales_logger'), name='dispatch') class AppInitS(LoginRequiredMixin, generic.base.TemplateView): template_name = 'logger/sales_logger.html' @method_decorator(access_required('sr_logger'), name='dispatch')
prepare_invoice_data(data['sr'], 'SalesReturnInvoice') else: data['sales'] = list(SalesInvoice.objects.values().filter( timestamp__range=(start, end), customer=cute).order_by('-timestamp')) prepare_invoice_data(data['sales'], 'SalesInvoice') data['sr'] = list(SalesReturnInvoice.objects.values().filter( timestamp__range=(start, end), customer=cute).order_by('-timestamp')) prepare_invoice_data(data['sr'], 'SalesReturnInvoice') return data # This view loads in the app @method_decorator(access_required('customer'), name='dispatch') class AppInit(LoginRequiredMixin, generic.base.TemplateView): template_name = 'customer/index.html' #Views for Customer model #create view class CreateCustomer(JSONCreateView): form = CustomerForm model = Customer #update view class UpdateCustomer(JSONUpdateView): form = CustomerForm model = Customer
from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from cash.helpers import (group_by_day, sort_time, prepare_changes_data, historate_cash) from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required # from django.db.models import Sum from sales.models import CashSale, CashSalesReturn from purchase.models import CashPurchase, CashPurchaseReturn from django.db.models import Sum, F, FloatField import datetime # This view loads in the app @method_decorator(access_required('cash'), name='dispatch') class AppInit(LoginRequiredMixin, generic.base.TemplateView): template_name = 'cash/index.html' class Systems(JSONQueryView): model = Cash def make_query(self, ask=None): cashs = super().make_query(ask) data = [] for cash in cashs: data.append({ 'id': cash['id'], 'value': cash['system'] + " ~ " + cash['currency'], 'currency': cash['currency'],
data['purchases'] = list( PurchaseInvoice.objects.values().filter( timestamp__range=(start, end), supplier=sup).order_by('-timestamp')) prepare_invoice_data(data['purchases'], 'PurchaseInvoice') data['pr'] = list( PurchaseReturnInvoice.objects.values().filter( timestamp__range=(start, end), supplier=sup).order_by('-timestamp')) prepare_invoice_data(data['pr'], 'PurchaseReturnInvoice') return data # This view loads in the app @method_decorator(access_required('supplier'), name='dispatch') class AppInit(generic.base.TemplateView): template_name = 'supplier/index.html' #Views for Supplier model #create view class CreateSupplier(JSONCreateView): form = SupplierForm model = Supplier #update view class UpdateSupplier(JSONUpdateView): form = SupplierForm model = Supplier
CreditSalesReturn,CashSalesReturn) from purchase.models import (CreditPurchase,CashPurchase, CreditPurchaseReturn,CashPurchaseReturn) from stats.periodic import (DailySaleRecord,DailyPurchaseRecord, WeeklySaleRecord,WeeklyPurchaseRecord, MonthlySaleRecord,MonthlyPurchaseRecord, YearlySaleRecord,YearlyPurchaseRecord) from stats.categoric import (ProdSaleRecord,ProdPurchaseRecord, UserSaleRecord,UserPurchaseRecord, PaySaleRecord,PayPurchaseRecord) from stats.export import some_pdf from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.decorators import method_decorator from work_data.decorators import access_required # These views loads in the apps @method_decorator(access_required('statsPurch'), name='dispatch') class AppInitP(LoginRequiredMixin,generic.base.TemplateView): template_name = 'stats/purchases.html' @method_decorator(access_required('statsSales'), name='dispatch') class AppInitS(LoginRequiredMixin,generic.base.TemplateView): template_name = 'stats/sales.html' # Daily Records class DailyCashS(DailySaleRecord): model = CashSale class DailyCashSr(DailySaleRecord): model = CashSalesReturn class DailyCashPc(DailyPurchaseRecord):