Esempio n. 1
0
    def list(self, request):
        syncall()
        filter_params = request.GET
        if filter_params.get("export_csv") == "true":
            if filter_params.get("date") != None:
                array_data = add_data_daily(filter_params["date"])
                path = create_file_date(array_data)
                response_data = {}
                response_data['success'] = True
                response_data['name'] = path
                return HttpResponse(json.dumps(response_data), content_type="application/json")

            else:

                array_data = add_data_month(filter_params["month"])
                path = create_file_month(array_data)
                response_data = {}
                response_data['success'] = True
                response_data['name'] = path
                return HttpResponse(json.dumps(response_data), content_type="application/json")


        else:
            if filter_params.get("date") != None:
                array_data = add_data_daily(filter_params["date"])
                serializer = ReportDailyDateSerializer(instance=array_data.values(), many=True)
                return Response(serializer.data)

            else:
                array_data = add_data_month(filter_params["month"])

                serializer = ReportDailyDateSerializer(instance=array_data.values(), many=True)
                return Response(serializer.data)
Esempio n. 2
0
 def get(self, request):
     """
     GET a product_categories
     :rtype: object
     """
     syncall()
     response_data = {}
     response_data['success'] = True
     return HttpResponse(json.dumps(response_data),
                         content_type="application/json",
                         status=200)
    def list(self, request):
        syncall()

        # product_all = Product.objects.all().annotate(sum_qty=Sum('withdrawdetail__quantity'))

        def data_input_transaction(product_all):
            for product in product_all:
                yield ReportWithdraw(
                    group="Transaction Withdraw Product Quantity",
                    keys="TWQ" + str(product.id),
                    nameEn=product.title,

                )

        serializer = WithdrawQuantitySerializer(instance=data_input_transaction(Product.objects.all()), many=True)
        return Response(serializer.data)
    def list(self, request):
        syncall()

        # product_all = Product.objects.all().annotate(sum_amt=Sum('withdrawdetail__amount'))

        def amount_input_transaction(product_all):
            for product in product_all:
                yield ReportWithdraw(
                    group="Transaction Withdraw Product Cost",
                    keys="TWC" + str(product.id),
                    nameEn=product.title,

                )

        serializer = WithdrawCostSerializer(instance=amount_input_transaction(Product.objects.all()), many=True)
        return Response(serializer.data)
Esempio n. 5
0
    def list(self, request):
        syncall()
        filter_params = request.GET
        array_period = filter_all(filter_params)
        array_data = create_data(filter_params)

        report_all = {
            1: ReportAll(
                categories=array_period
                ,
                series=array_data
            ),

        }

        serializer = ReportAllSerializer(instance=report_all.values(), many=True)
        return Response(serializer.data)
Esempio n. 6
0
 def list(self, request, *args, **kwargs):
     syncall()
     print "---------------------------------------!!!!!!!!!!!!!!!!!!!!!!"
     return super(ErpSyncedApiMixedIn, self).list(request, *args, **kwargs)
 def setUp(self):
     super(InputTransactionTestCase, self).setUp()
     self.test_user = User.objects.create_user('user1', '*****@*****.**', 'qwer1234')
     syncall()