示例#1
0
    def get(self, request):
        try:
            if self.request.query_params.get("Group") == "GET_OUTSTAND":
                obj_outstand = mFET.FET_model()
                obj_outstand.action = self.request.query_params.get("Action")
                obj_outstand.from_date = self.request.query_params.get(
                    "From_date")
                obj_outstand.to_date = self.request.query_params.get("To_date")
                obj_outstand.customer_gid = self.request.query_params.get(
                    "Cust_gid")
                obj_outstand.employee_gid = self.request.query_params.get(
                    "Emp_gid")
                obj_outstand.limit = self.request.query_params.get("limit")
                obj_outstand.entity_gid = self.request.query_params.get(
                    "Entity_gid")
                out_message = obj_outstand.get_outstanding_fet()
                if out_message.empty == False:
                    json_data = json.loads(
                        out_message.to_json(orient='records'))
                    return Response({"MESSAGE": "FOUND", "DATA": json_data})
                else:
                    return Response({"MESSAGE": "NOT_FOUND"})

        except Exception as e:
            return Response({"MESSAGE": "ERROR", "DATA": str(e)})
示例#2
0
def getapprove(request):
    if request.method == 'GET':
        objenti = mFET.FET_model()
        objenti.action = 'OutstandingCustomer'
        objenti.customer_gid = request.GET['cust_gid']
        objenti.limit = 30
        result_ent = objenti.get_FEToutstanding_fet()
        jdata = result_ent.to_json(orient='records')
        return JsonResponse(jdata, safe=False)
示例#3
0
def sales_favproduct(request):
    if request.method == 'POST':
        obj_sales_fav_pdct = mFET.FET_model()
        jsondata = json.loads(request.body.decode('utf-8'))
        obj_sales_fav_pdct.customer_gid = jsondata.get('parms').get('custid')
        obj_sales_fav_pdct.product_type = 1
        obj_sales_fav_pdct.entity_gid = request.session['Entity_gid']
        df_sales_fav_pdct = obj_sales_fav_pdct.get_sales_fav_product()
        jdata = df_sales_fav_pdct.to_json(orient='records')
        return JsonResponse(json.loads(jdata), safe=False)
示例#4
0
    def post(self, request):
        try:
            if self.request.query_params.get("Group") == "PRODUCT_GET":
                obj_product = mFET.FET_model()
                obj_product.type = self.request.query_params.get("Type")
                obj_product.sub_type = self.request.query_params.get("Subtype")
                obj_product.name = ''
                obj_product.limit = '100'

                out_message = obj_product.get_product()
                if len(out_message) > 0:
                    return Response({
                        "MESSAGE": "FOUND",
                        "DATA": json.loads(out_message)
                    })

        except Exception as e:
            return Response({"MESSAGE": "ERROR_OCCURED", "DATA": str(e)})
示例#5
0
 def check_authorization(request):
     tew = request.path.split("/")[1]
     print(tew)
     obj_check_detail = mFET.FET_model()
     obj_check_detail.employee_gid = request.session['Emp_gid']
     obj_check_detail.action = tew
     obj_check_detail.entity_gid = request.session['Entity_gid']
     obj_check_detail.create_by = request.session['Emp_gid']
     getdata = obj_check_detail.get_url()
     tempdata = models.outputReturn(getdata['MESSAGE'], 0)
     if (tempdata == 'FOUND'):
         return request
     else:
         utility.set_error_log(
             'Forbidden', ' Forbidden by Employee ID = ' +
             str(request.session['Emp_gid']) + ' - Employee Name = ' +
             request.session['Emp_name'])
         request.session.flush()
         return utility.error_403(request)
示例#6
0
    def post(self, request):
        try:
            if self.request.query_params.get("Group") == "Product_Get":
                jsondata = json.loads(request.body.decode('utf-8'))
                obj_product = mFET.FET_model()
                obj_product.type = self.request.query_params.get("Type")
                obj_product.subtype = self.request.query_params.get("SubType")
                obj_product.jsondata = json.dumps(jsondata.get('Filters'))
                out_message = obj_product.getsmry_product()
                if out_message.get("MESSAGE") == 'FOUND':
                    ld_dict = {
                        "DATA":
                        json.loads(
                            out_message.get("DATA").to_json(orient='records')),
                        "MESSAGE":
                        "FOUND"
                    }

                elif out_message.get("MESSAGE") == 'NOT_FOUND':
                    ld_dict = {"MESSAGE": out_message.get("MESSAGE")}
                else:
                    ld_dict = {
                        "MESSAGE":
                        'ERROR_OCCURED.' + out_message.get("MESSAGE")
                    }
                return Response(ld_dict)
            elif self.request.query_params.get("Group") == "Product_Set":
                jsondata = json.loads(request.body.decode('utf-8'))
                obj_product_set = mMasters.Masters()
                obj_product_set.action = self.request.query_params.get(
                    "Action")
                obj_product_set.type = self.request.query_params.get("Type")
                obj_product_set.jsonData = json.dumps(jsondata.get("data"))
                out_message = obj_product_set.Set_Productcat()
                if out_message[0] == "SUCCESS":
                    return Response({"MESSAGE": "SUCCESS"})
                else:
                    return Response({"MESSAGE": str(out_message[0])})
        except Exception as e:
            return Response({"MESSAGE": "ERROR_OCCURED", "DATA": str(e)})
示例#7
0
    def post(self, request):
        try:
            #   Group = SET_INITIAL, UPDATE_STATUS
            if self.request.query_params.get("Group") == "SET_INITIAL":
                jsondata = json.loads(request.body.decode('utf-8'))
                obj_cltn = mFET.FET_model()
                obj_cltn.action = self.request.query_params.get("Action")
                obj_cltn.type = self.request.query_params.get("Type")
                obj_cltn.collectionheader_gid = self.request.query_params.get("Collection_Gid")
                obj_cltn.customer_gid = self.request.query_params.get("Customer_Gid")
                obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid")
                obj_cltn.mode = self.request.query_params.get("Collection_Mode")
                obj_cltn.amount = self.request.query_params.get("Collection_Amount")
                obj_cltn.date = self.request.query_params.get("Collection_Date")
                obj_cltn.cheque_no = '';
                obj_cltn.remark = self.request.query_params.get("Collection_Description")
                obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid")
                obj_cltn.create_by = self.request.query_params.get("Employee_Gid")
                obj_cltn.jsonData = jsondata.get("Params").get("CHEQUE")
                file  = json.dumps(jsondata.get('Params').get('File'))
                if file != '[]':
                    lst_saved_filepath = commonview.File_Upload(file, 'CHEQUE', obj_cltn.create_by)
                    obj_cltn.json_file = json.dumps({'File':lst_saved_filepath})
                else:
                    obj_cltn.json_file = json.dumps(jsondata.get('Params').get('File'))

                out_message = obj_cltn.set_collection()
                if out_message[0] == "SUCCESS":
                    return Response({"MESSAGE": "SUCCESS"})
                else:
                    return Response({"MESSAGE": "FAIL","DATA":str(out_message[0])})

            elif self.request.query_params.get("Group") == "UPDATE_STATUS":
                obj_cltn = mFET.FET_model()
                obj_cltn.action = self.request.query_params.get("Action")
                obj_cltn.type = self.request.query_params.get("Type")
                obj_cltn.collectionheader_gid = 0
                obj_cltn.customer_gid = 0
                obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid")
                obj_cltn.mode = ''
                obj_cltn.amount = 0
                obj_cltn.date = ''
                obj_cltn.cheque_no = ''
                obj_cltn.remark = ''
                obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid")
                obj_cltn.create_by = self.request.query_params.get("Employee_Gid")
                obj_cltn.jsonData = json.loads(request.body.decode('utf-8'))

                out_message = obj_cltn.set_collection()
                if out_message[0] == "SUCCESS":
                    return Response({"MESSAGE": "SUCCESS"})
                else:
                    return Response({"MESSAGE": "FAIL", "DATA": str(out_message[0])})

            elif self.request.query_params.get("Group") == "COLLECTION_DELETE":
                obj_cltn = mFET.FET_model()
                obj_cltn.action = self.request.query_params.get("Action")
                obj_cltn.type = self.request.query_params.get("Type")
                obj_cltn.collectionheader_gid = self.request.query_params.get("Collection_Gid")
                obj_cltn.customer_gid = 0
                obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid")
                obj_cltn.mode = ''
                obj_cltn.amount = 0
                obj_cltn.date = ''
                obj_cltn.cheque_no = ''
                obj_cltn.remark = ''
                obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid")
                obj_cltn.create_by = self.request.query_params.get("Employee_Gid")
                obj_cltn.jsonData = {}
                out_message = obj_cltn.set_collection()
                if out_message[0] == "SUCCESS":
                    return Response({"MESSAGE": "SUCCESS"})
                else:
                    return Response({"MESSAGE": "FAIL", "DATA": str(out_message[0])})

            elif self.request.query_params.get("Group") == "UPDATE_DISPATCH":
                obj_cltn = mService.Service_model()
                obj_cltn.action = self.request.query_params.get("Action")
                obj_cltn.type = self.request.query_params.get("Type")
                obj_cltn.in_out = self.request.query_params.get("In_Out")
                obj_cltn.courier_gid = self.request.query_params.get("Courier_Gid")
                obj_cltn.Dispatch_date = self.request.query_params.get("Dispatch_Date")
                obj_cltn.send_by = self.request.query_params.get("Send_By")
                obj_cltn.awbno = self.request.query_params.get("AWB_No")
                obj_cltn.dispatch_mode = self.request.query_params.get("Dispatch_Mode")
                obj_cltn.dispatch_type = self.request.query_params.get("Packets")
                obj_cltn.weight = self.request.query_params.get("Weight")
                obj_cltn.dispatch_to = self.request.query_params.get("Dispatch_To")
                obj_cltn.address = self.request.query_params.get("Address")
                obj_cltn.city = self.request.query_params.get("City")
                obj_cltn.state = self.request.query_params.get("State")
                obj_cltn.pincode =self.request.query_params.get("Pincode")
                obj_cltn.remark = self.request.query_params.get("Remark")
                obj_cltn.returned = self.request.query_params.get("Returned")
                obj_cltn.returned_on = ''
                obj_cltn.returned_remark = ''
                obj_cltn.pod = ''
                obj_cltn.pod_image = ''
                obj_cltn.isactive = ''
                obj_cltn.isremoved = ''
                obj_cltn.dispatch_gid = 0
                obj_cltn.SERVICE_JSON = json.loads(request.body.decode('utf-8'))
                obj_cltn.status = self.request.query_params.get("Status")
                obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid")
                obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid")

                out_message = obj_cltn.set_Dispatch()

                if out_message[0] == "SUCCESS":
                    return Response({"MESSAGE": "SUCCESS"})
                else:
                    return Response({"MESSAGE": "FAIL", "DATA": str(out_message[0])})



            elif self.request.query_params.get("Group") == "INV_RECEIPT":
                obj_cltn = mCollection.Collection_model()
                obj_cltn.action = self.request.query_params.get("Action")
                obj_cltn.type = self.request.query_params.get("Type")
                obj_cltn.commit = self.request.query_params.get("commit")
                obj_cltn.create_by = self.request.query_params.get("Create_by")
                obj_cltn.jsonData = json.loads(request.body.decode('utf-8')).get('params').get('DATA')
                obj_cltn.json_classification = json.loads(request.body.decode('utf-8')).get('params').get('Classification')

                out_message = outputReturn(obj_cltn.set_invreceipt_map(), 1)
                if out_message == "SUCCESS":
                    return Response({"MESSAGE": "SUCCESS"})
                else:
                    return Response({"MESSAGE": "FAIL", "DATA": str(out_message)})



        except Exception as e:
                return Response({"MESSAGE": "ERROR","DATA":str(e)})