rp041993 3 yıl önce
ebeveyn
işleme
0dab59e2cb

BIN
__pycache__/config.cpython-37.pyc


+ 2 - 1
config.py

@@ -1,6 +1,7 @@
 SECRET_KEY='sacC2p7rFaljsacC' # Secret key for flask project
 MONGO_DBNAME='Migration' # Database name
-MONGO_URI='mongodb://kefOnboard:sacC2p7rFaLj@ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:27017/Migration' # MongoDB URI
+# MONGO_URI='mongodb://kefOnboard:sacC2p7rFaLj@65.2.132.48:27017/Migration' # MongoDB URI
+MONGO_URI='mongodb://kefOnboard:sacC2p7rFaLj@127.0.0.1:27017/Migration' # MongoDB URI
 
 TEMPLATES_AUTO_RELOAD=True
 PORT=9005 # Flask running port

BIN
service/__pycache__/reports_service.cpython-37.pyc


BIN
service/__pycache__/voucher_list.cpython-37.pyc


+ 3 - 3
service/reports_service.py

@@ -34,7 +34,7 @@ def getMouReportDataService(from_date, to_date, mongo):
                                                       1000).strftime("%x")
 
                 if 'mou_file' in mou:
-                    mou_file = "http://ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:9005/uploads/" + mou[
+                    mou_file = "http://65.2.132.48:9005/uploads/" + mou[
                         'mou_file']
 
                 insert_obj = {
@@ -556,7 +556,7 @@ def getVoucherMISReportDataService(from_date, to_date, mongo):
                 
                 invoice_url=[]
                 for invoice in voucher['invoices']:
-                    invoice_url.append('http://ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:9005/uploads/'+invoice)
+                    invoice_url.append('http://65.2.132.48:9005/uploads/'+invoice)
                 
 
                 insert_obj = {
@@ -601,7 +601,7 @@ def getVoucherMISReportDataService(from_date, to_date, mongo):
                         insert_obj['vendor_name'+str(k)]=quotation['v_name']
                         insert_obj['exception'+str(k)]=quotation['exception']
                         insert_obj['note'+str(k)]=quotation['note']
-                        insert_obj['quote_file'+str(k)]='http://ec2-13-127-150-184.ap-south-1.compute.amazonaws.com:9005/uploads/'+quotation['quote_file']
+                        insert_obj['quote_file'+str(k)]='http://65.2.132.48:9005/uploads/'+quotation['quote_file']
                         k+=1
                 else:
                     for k in range(1,4):

+ 49 - 7
service/voucher_list.py

@@ -260,7 +260,7 @@ def createVoucherService(files,data,app,mongo):
                         suffix.append(key[len('product_dec'):])
 
                 od = []
-
+                total_amount = 0
                 # Upload Order Details
                 for value in suffix:
                     
@@ -311,12 +311,14 @@ def createVoucherService(files,data,app,mongo):
                                                             str(value)])
 
                     if append == True:
+                        total_amount += (quote['product_amount'] * quote['product_qty']) + quote['product_gst']
                         od.append(quote)
 
                 insert_doc['od'] = od
                 
                 if 'p_additional_charges'  in data:
                     insert_doc['po_additional_charges'] = float(data['p_additional_charges'])
+                    total_amount+=insert_doc['po_additional_charges']
 
                 if 'tds_rate'  in data:
                     insert_doc['tds_rate'] = float(data['tds_rate'])
@@ -423,9 +425,8 @@ def createVoucherService(files,data,app,mongo):
                         selectGenrate==True
 
                 if 'product_total_amount' in data:
-                    insert_doc['product_total_amount'] = float(data['product_total_amount' ])
-                    total_amount = float(data['product_total_amount'])
-                    insert_doc['product_gross_amount'] = float(data['product_total_amount' ])
+                    insert_doc['product_total_amount'] = total_amount
+                    insert_doc['product_gross_amount'] = total_amount
 
                 if 'vendor_type' in data and data['vendor_type']=='registered':
                     if 'vendors' in data and data['vendors'] != '':
@@ -468,8 +469,8 @@ def createVoucherService(files,data,app,mongo):
                     insert_doc['MOP'] = MOP
 
                 if 'amount_words' in data and data['amount_words'] != '':
-                    amount_words = data['amount_words']  # MOU Expiry
-                    insert_doc['amount_words'] = amount_words
+                    amount_words = number_to_word(total_amount)
+                    insert_doc['amount_words'] = amount_words.lower()
 
                 if 'intervention' in data and data['intervention']!='':
                     insert_doc['intervention']=data['intervention']
@@ -930,4 +931,45 @@ def createAndGenrateAssetCode(data,od,voucher_code,timestamp,mongo):
         create_voucher=False
         print(err)
 
-    return create_voucher
+    return create_voucher
+
+def number_to_word(number):
+    def get_word(n):
+        words={ 0:"", 1:"One", 2:"Two", 3:"Three", 4:"Four", 5:"Five", 6:"Six", 7:"Seven", 8:"Eight", 9:"Nine", 10:"Ten", 11:"Eleven", 12:"Twelve", 13:"Thirteen", 14:"Fourteen", 15:"Fifteen", 16:"Sixteen", 17:"Seventeen", 18:"Eighteen", 19:"Nineteen", 20:"Twenty", 30:"Thirty", 40:"Forty", 50:"Fifty", 60:"Sixty", 70:"Seventy", 80:"Eighty", 90:"Ninty" }
+        if n<=20:
+            return words[n]
+        else:
+            ones=n%10
+            tens=n-ones
+            return words[tens]+" "+words[ones]
+            
+    def get_all_word(n):
+        d=[100,10,100,100]
+        v=["","Hundred And","Thousand","lakh"]
+        w=[]
+        for i,x in zip(d,v):
+            t=get_word(n%i)
+            if t!="":
+                t+=" "+x
+            w.append(t.rstrip(" "))
+            n=n//i
+        w.reverse()
+        w=' '.join(w).strip()
+        if w.endswith("And"):
+            w=w[:-3]
+        return w
+
+    arr=str(number).split(".")
+    number=int(arr[0])
+    crore=number//10000000
+    number=number%10000000
+    word=""
+    if crore>0:
+        word+=get_all_word(crore)
+        word+=" crore "
+    word+=get_all_word(number).strip()+" Rupees"
+    if len(arr)>1:
+         if len(arr[1])==1:
+            arr[1]+="0"
+         word+=" and "+get_all_word(int(arr[1]))+" paisa"
+    return word

BIN
utils/__pycache__/Email.cpython-37.pyc