예제 #1
0
 def make_query(self,ask):
     start =  ask.get('start')
     end = ask.get('end')
     if start is None or end is None:
         data = list(self.model.objects.filter(**ask).values().order_by('-timestamp'))
         prepare_invoice_data(data,'PurchaseReturnInvoice')
         return data
     else:
         data = list(self.model.objects.values().filter(timestamp__range=(start,end)).order_by('-timestamp'))
         prepare_invoice_data(data,'PurchaseReturnInvoice')
     return data
예제 #2
0
    def make_query(self, ask):
        start = ask.get('start')
        end = ask.get('end')
        cute = ask.get('id')
        if not cute:
            data = {'status': False, 'msg': 'Customer not specified'}
        else:
            data = {'status': True}
            if start is None or end is None:
                data['sales'] = list(SalesInvoice.objects.values().filter(
                    customer=cute).order_by('-timestamp'))
                prepare_invoice_data(data['sales'], 'SalesInvoice')

                data['sr'] = list(SalesReturnInvoice.objects.values().filter(
                    customer=cute).order_by('-timestamp'))
                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
예제 #3
0
    def make_query(self, ask):
        start = ask.get('start')
        end = ask.get('end')
        sup = ask.get('id')
        if not sup:
            data = {'status': False, 'msg': 'Customer not specified'}
        else:
            data = {'status': True}
            if start is None or end is None:
                data['purchases'] = list(
                    PurchaseInvoice.objects.values().filter(
                        supplier=sup).order_by('-timestamp'))
                prepare_invoice_data(data['purchases'], 'PurchaseInvoice')

                data['pr'] = list(
                    PurchaseReturnInvoice.objects.values().filter(
                        supplier=sup).order_by('-timestamp'))
                prepare_invoice_data(data['pr'], 'PurchaseReturnInvoice')
            else:
                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