form_16a party address pull fix
This commit is contained in:
parent
8491384946
commit
402ebab7df
@ -18,85 +18,93 @@ convert_to_lists = webnotes.conn.convert_to_lists
|
|||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class DocType(TransactionBase):
|
class DocType(TransactionBase):
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
self.doc.name = make_autoname('Form 16A' + '/.#####')
|
self.doc.name = make_autoname('Form 16A' + '/.#####')
|
||||||
|
|
||||||
# Get pan no and tan no from company
|
# Get pan no and tan no from company
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
def get_registration_details(self):
|
def get_registration_details(self):
|
||||||
comp_det=sql("Select address,registration_details from `tabCompany` where name = '%s'"%(self.doc.company))
|
comp_det=sql("Select address,registration_details from `tabCompany` where name = '%s'"%(self.doc.company))
|
||||||
if not comp_det:
|
if not comp_det:
|
||||||
msgprint("Registration Details is not mentioned in comapny")
|
msgprint("Registration Details is not mentioned in comapny")
|
||||||
ret = {
|
ret = {
|
||||||
'company_address':'',
|
'company_address':'',
|
||||||
'registration_details': ''
|
'registration_details': ''
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
ret = {
|
ret = {
|
||||||
'company_address': cstr(comp_det[0][0]),
|
'company_address': cstr(comp_det[0][0]),
|
||||||
'registration_details': cstr(comp_det[0][1])
|
'registration_details': cstr(comp_det[0][1])
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return cstr(ret)
|
||||||
|
|
||||||
# Get party details
|
# Get party details
|
||||||
#------------------
|
#------------------
|
||||||
def get_party_det(self):
|
def get_party_det(self):
|
||||||
party_det=sql("Select pan_number, address from `tabAccount` where name = '%s'" % self.doc.party_name)
|
party_det=sql("select master_type, master_name, pan_number from `tabAccount` where name='%s'" % self.doc.party_name)
|
||||||
ret = {
|
if party_det and party_det[0][0]=='Supplier':
|
||||||
'pan_number': cstr(party_det[0][0]) ,
|
try:
|
||||||
'party_address': cstr(party_det[0][1])
|
rec = sql("select name, address_line1, address_line2, city, country, pincode, state from `tabAddress` where supplier = '%s' and docstatus != 2 order by is_primary_address desc limit 1" %(party_det[0][1]), as_dict = 1)
|
||||||
}
|
address_display = cstr((rec[0]['address_line1'] and rec[0]['address_line1'] or '')) + cstr((rec[0]['address_line2'] and '\n' + rec[0]['address_line2'] or '')) + cstr((rec[0]['city'] and '\n'+rec[0]['city'] or '')) + cstr((rec[0]['pincode'] and '\n' + rec[0]['pincode'] or '')) + cstr((rec[0]['state'] and '\n'+rec[0]['state'] or '')) + cstr((rec[0]['country'] and '\n'+rec[0]['country'] or ''))
|
||||||
return cstr(ret)
|
except:
|
||||||
|
address_display = ''
|
||||||
|
|
||||||
|
ret = {
|
||||||
|
'pan_number': cstr(party_det[0][2]) ,
|
||||||
|
'party_address': cstr(address_display)
|
||||||
|
}
|
||||||
|
|
||||||
|
return cstr(ret)
|
||||||
|
|
||||||
|
# Get TDS Return acknowledgement
|
||||||
|
#-------------------------------
|
||||||
|
def get_return_ack_details(self):
|
||||||
|
self.doc.clear_table(self.doclist, 'form_16A_ack_details')
|
||||||
|
if not (self.doc.from_date and self.doc.to_date):
|
||||||
|
msgprint("Please enter From Date, To Date")
|
||||||
|
else:
|
||||||
|
ack = sql("select quarter, acknowledgement_no from `tabTDS Return Acknowledgement` where date_of_receipt>='%s' and date_of_receipt<='%s' and tds_category = '%s' order by date_of_receipt ASC" % (self.doc.from_date, self.doc.to_date, self.doc.tds_category))
|
||||||
|
for d in ack:
|
||||||
|
ch = addchild(self.doc, 'form_16A_ack_details', 'Form 16A Ack Detail', 1, self.doclist)
|
||||||
|
ch.quarter = d[0]
|
||||||
|
ch.ack_no = d[1]
|
||||||
|
|
||||||
# Get TDS Return acknowledgement
|
# Get tds payment details
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
def get_return_ack_details(self):
|
def get_tds(self):
|
||||||
self.doc.clear_table(self.doclist, 'form_16A_ack_details')
|
self.doc.clear_table(self.doclist,'form_16A_tax_details')
|
||||||
if not (self.doc.from_date and self.doc.to_date):
|
import datetime
|
||||||
msgprint("Please enter From Date, To Date")
|
if self.doc.from_date and self.doc.to_date and self.doc.tds_category:
|
||||||
else:
|
tot=0.0
|
||||||
ack = sql("select quarter, acknowledgement_no from `tabTDS Return Acknowledgement` where date_of_receipt>='%s' and date_of_receipt<='%s' and tds_category = '%s' order by date_of_receipt ASC" % (self.doc.from_date, self.doc.to_date, self.doc.tds_category))
|
party_tds_list=sql("select t2.amount_paid,t2.date_of_payment,t2.tds_amount,t2.cess_on_tds, t2.total_tax_amount, t1.cheque_no, t1.bsr_code, t1.date_of_receipt, t1.challan_id from `tabTDS Payment` t1, `tabTDS Payment Detail` t2 where t1.tds_category='%s' and t2.party_name='%s' and t1.from_date >= '%s' and t1.to_date <= '%s' and t2.total_tax_amount>0 and t2.parent=t1.name and t1.docstatus=1" % (self.doc.tds_category,self.doc.party_name,self.doc.from_date,self.doc.to_date))
|
||||||
for d in ack:
|
for s in party_tds_list:
|
||||||
ch = addchild(self.doc, 'form_16A_ack_details', 'Form 16A Ack Detail', 1, self.doclist)
|
child = addchild(self.doc, 'form_16A_tax_details', 'Form 16A Tax Detail', 1, self.doclist)
|
||||||
ch.quarter = d[0]
|
child.amount_paid = s and flt(s[0]) or ''
|
||||||
ch.ack_no = d[1]
|
child.date_of_payment =s and s[1].strftime('%Y-%m-%d') or ''
|
||||||
|
child.tds_main = s and flt(s[2]) or ''
|
||||||
# Get tds payment details
|
child.surcharge = 0
|
||||||
#-------------------------------
|
child.cess_on_tds = s and flt(s[3]) or ''
|
||||||
def get_tds(self):
|
child.total_tax_deposited = s and flt(s[4]) or ''
|
||||||
self.doc.clear_table(self.doclist,'form_16A_tax_details')
|
child.cheque_no = s and s[5] or ''
|
||||||
import datetime
|
child.bsr_code = s and s[6] or ''
|
||||||
if self.doc.from_date and self.doc.to_date and self.doc.tds_category:
|
child.tax_deposited_date = s and s[7].strftime('%Y-%m-%d') or ''
|
||||||
tot=0.0
|
child.challan_no = s and s[8] or ''
|
||||||
party_tds_list=sql("select t2.amount_paid,t2.date_of_payment,t2.tds_amount,t2.cess_on_tds, t2.total_tax_amount, t1.cheque_no, t1.bsr_code, t1.date_of_receipt, t1.challan_id from `tabTDS Payment` t1, `tabTDS Payment Detail` t2 where t1.tds_category='%s' and t2.party_name='%s' and t1.from_date >= '%s' and t1.to_date <= '%s' and t2.total_tax_amount>0 and t2.parent=t1.name and t1.docstatus=1" % (self.doc.tds_category,self.doc.party_name,self.doc.from_date,self.doc.to_date))
|
tot=flt(tot)+flt(s[4])
|
||||||
for s in party_tds_list:
|
self.doc.total_amount = flt(tot)
|
||||||
child = addchild(self.doc, 'form_16A_tax_details', 'Form 16A Tax Detail', 1, self.doclist)
|
else:
|
||||||
child.amount_paid = s and flt(s[0]) or ''
|
msgprint("Plaese enter from date, to date and TDS category")
|
||||||
child.date_of_payment =s and s[1].strftime('%Y-%m-%d') or ''
|
|
||||||
child.tds_main = s and flt(s[2]) or ''
|
|
||||||
child.surcharge = 0
|
# validate
|
||||||
child.cess_on_tds = s and flt(s[3]) or ''
|
#----------------
|
||||||
child.total_tax_deposited = s and flt(s[4]) or ''
|
def validate(self):
|
||||||
child.cheque_no = s and s[5] or ''
|
tot=0.0
|
||||||
child.bsr_code = s and s[6] or ''
|
for d in getlist(self.doclist,'form_16A_tax_details'):
|
||||||
child.tax_deposited_date = s and s[7].strftime('%Y-%m-%d') or ''
|
tot=flt(tot)+flt(d.total_tax_deposited)
|
||||||
child.challan_no = s and s[8] or ''
|
|
||||||
tot=flt(tot)+flt(s[4])
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
self.doc.total_amount = flt(tot)
|
self.doc.total_amount = flt(tot)
|
||||||
else:
|
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.total_amount)
|
||||||
msgprint("Plaese enter from date, to date and TDS category")
|
|
||||||
|
|
||||||
|
|
||||||
# validate
|
|
||||||
#----------------
|
|
||||||
def validate(self):
|
|
||||||
tot=0.0
|
|
||||||
for d in getlist(self.doclist,'form_16A_tax_details'):
|
|
||||||
tot=flt(tot)+flt(d.total_tax_deposited)
|
|
||||||
|
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
|
||||||
self.doc.total_amount = flt(tot)
|
|
||||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.total_amount)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user