Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-12-05 06:02:28 +01:00
commit ce7cc74033
68 changed files with 288 additions and 3406 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,48 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(doc.company)get_server_fields('get_registration_details','','',doc,cdt,cdn,1);
}
cur_frm.cscript.company = function(doc,cdt,cdn){
if(doc.company)get_server_fields('get_registration_details','','',doc,cdt,cdn);
}
cur_frm.fields_dict['party_name'].get_query = function(doc, cdt, cdn) {
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.master_type = "Supplier" AND `tabAccount`.docstatus != 2 AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
}
cur_frm.cscript.party_name = function(doc,cdt,cdn){
if(doc.party_name)get_server_fields('get_party_det','','',doc,cdt,cdn);
}
// Date validation
cur_frm.cscript.to_date = function(doc,cdt,cdn){
if((doc.from_date) && (doc.to_date) && (doc.from_date>doc.to_date)){
alert("From date can not be greater than To date");
doc.to_date='';
refresh_field('to_date');
}
}
cur_frm.cscript.from_date = function(doc,cdt,cdn){
if((doc.from_date) && (doc.to_date) && (doc.from_date>doc.to_date)){
alert("From date can not be greater than To date");
doc.from_date='';
refresh_field('from_date');
}
}

View File

@ -1,120 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt, now
from webnotes.model import db_exists
from webnotes.model.doc import addchild, make_autoname
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj
from webnotes import form, msgprint
sql = webnotes.conn.sql
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
def __init__(self,d,dl):
self.doc, self.doclist = d, dl
def autoname(self):
self.doc.name = make_autoname('Form 16A' + '/.#####')
# Get pan no and tan no from company
#-------------------------------------
def get_registration_details(self):
comp_det=sql("Select address,registration_details from `tabCompany` where name = '%s'"%(self.doc.company))
if not comp_det:
msgprint("Registration Details is not mentioned in comapny")
ret = {
'company_address':'',
'registration_details': ''
}
else:
ret = {
'company_address': cstr(comp_det[0][0]),
'registration_details': cstr(comp_det[0][1])
}
return ret
# Get party details
#------------------
def get_party_det(self):
party_det=sql("select master_type, master_name from `tabAccount` where name='%s'" % self.doc.party_name)
if party_det and party_det[0][0]=='Supplier':
try:
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 ''))
except:
address_display = ''
ret = {
'party_address': cstr(address_display)
}
return ret
# Get TDS Return acknowledgement
#-------------------------------
def get_return_ack_details(self):
self.doclist = 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 payment details
#-------------------------------
def get_tds(self):
self.doclist = self.doc.clear_table(self.doclist,'form_16A_tax_details')
import datetime
if self.doc.from_date and self.doc.to_date and self.doc.tds_category:
tot=0.0
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 s in party_tds_list:
child = addchild(self.doc, 'form_16A_tax_details', 'Form 16A Tax Detail', 1, self.doclist)
child.amount_paid = s and flt(s[0]) or ''
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
child.cess_on_tds = s and flt(s[3]) or ''
child.total_tax_deposited = s and flt(s[4]) or ''
child.cheque_no = s and s[5] or ''
child.bsr_code = s and s[6] or ''
child.tax_deposited_date = s and s[7].strftime('%Y-%m-%d') or ''
child.challan_no = s and s[8] or ''
tot=flt(tot)+flt(s[4])
self.doc.total_amount = flt(tot)
else:
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)

View File

@ -1,344 +0,0 @@
[
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-03 13:29:51",
"modified_by": "Administrator",
"modified": "2012-12-03 17:10:41"
},
{
"in_create": 0,
"doctype": "DocType",
"module": "Accounts",
"name": "__common__"
},
{
"name": "__common__",
"parent": "Form 16A",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Form 16A",
"read": 1,
"doctype": "DocPerm",
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Form 16A",
"doctype": "DocType"
},
{
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break0",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "From Date",
"oldfieldname": "from_date",
"fieldname": "from_date",
"fieldtype": "Date",
"reqd": 1,
"permlevel": 0
},
{
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "To Date",
"oldfieldname": "to_date",
"trigger": "Client",
"fieldname": "to_date",
"fieldtype": "Date",
"reqd": 1,
"permlevel": 0
},
{
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "TDS Category",
"oldfieldname": "tds_category",
"options": "TDS Category",
"fieldname": "tds_category",
"fieldtype": "Link",
"reqd": 1,
"permlevel": 0,
"in_filter": 1
},
{
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Party Name",
"oldfieldname": "party_name",
"permlevel": 0,
"trigger": "Client",
"fieldname": "party_name",
"fieldtype": "Link",
"reqd": 1,
"hidden": 0,
"options": "Account",
"in_filter": 1
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Address",
"oldfieldname": "party_address",
"fieldname": "party_address",
"fieldtype": "Small Text",
"reqd": 0,
"permlevel": 1
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "PAN No",
"oldfieldname": "pan_number",
"fieldname": "pan_number",
"fieldtype": "Data",
"hidden": 0,
"permlevel": 1
},
{
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"options": "link:Fiscal Year",
"fieldname": "fiscal_year",
"fieldtype": "Select",
"reqd": 1,
"permlevel": 0
},
{
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Company ",
"oldfieldname": "company",
"options": "Company",
"fieldname": "company",
"fieldtype": "Link",
"search_index": 1,
"reqd": 1,
"permlevel": 0,
"in_filter": 1
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Company Address",
"oldfieldname": "company_address",
"fieldname": "company_address",
"fieldtype": "Small Text",
"permlevel": 1
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Registration Details",
"oldfieldname": "registration_details",
"fieldname": "registration_details",
"fieldtype": "Small Text",
"permlevel": 0
},
{
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "Return Details",
"fieldname": "return_details",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Get Return Details",
"options": "get_return_ack_details",
"fieldname": "get_return_details",
"fieldtype": "Button",
"permlevel": 0
},
{
"oldfieldtype": "Table",
"doctype": "DocField",
"label": "Form 16A Ack Details",
"oldfieldname": "form_16A_ack_details",
"options": "Form 16A Ack Detail",
"fieldname": "form_16A_ack_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "Payment Details",
"fieldname": "payment_details",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Get TDS",
"options": "get_tds",
"fieldname": "get_tds",
"fieldtype": "Button",
"permlevel": 0
},
{
"oldfieldtype": "Table",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Tax Details",
"oldfieldname": "form_16A_tax_details",
"options": "Form 16A Tax Detail",
"fieldname": "form_16A_tax_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Total Amount",
"oldfieldname": "total_amount",
"fieldname": "total_amount",
"fieldtype": "Currency",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "In Words",
"fieldname": "in_words",
"fieldtype": "Data",
"permlevel": 1
},
{
"oldfieldtype": "Section Break",
"doctype": "DocField",
"options": "Simple",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break2",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Place",
"oldfieldname": "place",
"fieldname": "place",
"fieldtype": "Data",
"permlevel": 0
},
{
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Date",
"oldfieldname": "dt",
"fieldname": "dt",
"fieldtype": "Date",
"permlevel": 0
},
{
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Full Name",
"oldfieldname": "full_name",
"fieldname": "full_name",
"fieldtype": "Data",
"permlevel": 0
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Designation",
"oldfieldname": "designation",
"fieldname": "designation",
"fieldtype": "Data",
"permlevel": 0
},
{
"amend": 0,
"create": 0,
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"role": "Accounts Manager",
"cancel": 0,
"permlevel": 1
},
{
"amend": 0,
"create": 1,
"doctype": "DocPerm",
"submit": 0,
"write": 1,
"role": "Accounts Manager",
"cancel": 0,
"permlevel": 0
},
{
"amend": 0,
"create": 0,
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"role": "Accounts User",
"cancel": 0,
"permlevel": 1
},
{
"amend": 0,
"create": 1,
"doctype": "DocPerm",
"submit": 0,
"write": 1,
"role": "Accounts User",
"cancel": 0,
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "System Manager",
"permlevel": 0
},
{
"doctype": "DocPerm",
"role": "System Manager",
"permlevel": 1
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,61 +0,0 @@
# DocType, Form 16A Ack Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:42',
'docstatus': 0,
'modified': '2012-03-27 14:35:42',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Tray',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Form 16A Ack Detail',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, Form 16A Ack Detail
{
'doctype': 'DocType',
'name': u'Form 16A Ack Detail'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'quarter',
'fieldtype': u'Select',
'label': u'Quarter',
'oldfieldname': u'quarter',
'oldfieldtype': u'Select',
'options': u'\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'ack_no',
'fieldtype': u'Data',
'label': u'Acknowledgement No.',
'oldfieldname': u'ack_no',
'oldfieldtype': u'Data'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,140 +0,0 @@
# DocType, Form 16A Tax Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:42',
'docstatus': 0,
'modified': '2012-03-27 14:35:42',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Tray',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Form 16A Tax Detail',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, Form 16A Tax Detail
{
'doctype': 'DocType',
'name': u'Form 16A Tax Detail'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amount_paid',
'fieldtype': u'Currency',
'label': u'Amount paid / credited',
'oldfieldname': u'amount_paid',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'date_of_payment',
'fieldtype': u'Date',
'label': u'Date of payment / credit',
'oldfieldname': u'date_of_payment',
'oldfieldtype': u'Date'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_main',
'fieldtype': u'Currency',
'label': u'TDS(Main)',
'oldfieldname': u'tds_main',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'surcharge',
'fieldtype': u'Currency',
'label': u'Surcharge',
'oldfieldname': u'surcharge',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cess_on_tds',
'fieldtype': u'Currency',
'label': u'Cess on TDS',
'oldfieldname': u'cess_on_tds',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'total_tax_deposited',
'fieldtype': u'Currency',
'label': u'Total Tax Deposited',
'oldfieldname': u'total_tax_deposited',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cheque_no',
'fieldtype': u'Data',
'label': u'Cheque / DD No.',
'oldfieldname': u'cheque_no',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'bsr_code',
'fieldtype': u'Data',
'label': u'BSR Code',
'oldfieldname': u'bsr_code',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tax_deposited_date',
'fieldtype': u'Date',
'label': u'Tax Deposited Date',
'oldfieldname': u'tax_deposited_date',
'oldfieldtype': u'Date'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'challan_no',
'fieldtype': u'Data',
'label': u'Challan No.',
'oldfieldname': u'challan_no',
'oldfieldtype': u'Data'
}
]

View File

@ -204,7 +204,14 @@ class DocType:
# ADVANCE ALLOCATION
#-------------------
def get_advances(self, obj, account_head, table_name,table_field_name, dr_or_cr):
jv_detail = webnotes.conn.sql("select t1.name, t1.remark, t2.%s, t2.name, t1.ded_amount from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and (t2.against_voucher is null or t2.against_voucher = '') and (t2.against_invoice is null or t2.against_invoice = '') and (t2.against_jv is null or t2.against_jv = '') and t2.account = '%s' and t2.is_advance = 'Yes' and t1.docstatus = 1 order by t1.voucher_date " % (dr_or_cr,account_head))
jv_detail = webnotes.conn.sql("""select t1.name, t1.remark, t2.%s, t2.name
from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
where t1.name = t2.parent
and (t2.against_voucher is null or t2.against_voucher = '')
and (t2.against_invoice is null or t2.against_invoice = '')
and (t2.against_jv is null or t2.against_jv = '')
and t2.account = '%s' and t2.is_advance = 'Yes' and t1.docstatus = 1
order by t1.voucher_date """ % (dr_or_cr,account_head))
# clear advance table
obj.doclist = obj.doc.clear_table(obj.doclist,table_field_name)
# Create advance table
@ -215,9 +222,7 @@ class DocType:
add.remarks = d[1]
add.advance_amount = flt(d[2])
add.allocate_amount = 0
if table_name == 'Purchase Invoice Advance':
add.tds_amount = flt(d[4])
return obj.doclist
# Clear rows which is not adjusted

View File

@ -117,23 +117,21 @@ class DocType:
def update_outstanding_amt(self):
# get final outstanding amt
bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
tds = 0
if self.doc.against_voucher_type=='Purchase Invoice':
# amount to debit
bal = -bal
# Check if tds applicable
tds = sql("select total_tds_on_voucher from `tabPurchase Invoice` where name = '%s'" % self.doc.against_voucher)
tds = tds and flt(tds[0][0]) or 0
# Validation : Outstanding can not be negative
if bal < 0 and not tds and self.doc.is_cancelled == 'No':
msgprint("Outstanding for Voucher %s will become %s. Outstanding cannot be less than zero. Please match exact outstanding." % (self.doc.against_voucher, fmt_money(bal)))
if bal < 0 and self.doc.is_cancelled == 'No':
msgprint("""Outstanding for Voucher %s will become %s.
Outstanding cannot be less than zero. Please match exact outstanding.""" %
(self.doc.against_voucher, fmt_money(bal)))
raise Exception
# Update outstanding amt on against voucher
sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (self.doc.against_voucher_type,bal,self.doc.against_voucher))
sql("update `tab%s` set outstanding_amount=%s where name='%s'"%
(self.doc.against_voucher_type, bal, self.doc.against_voucher))
# Total outstanding can not be greater than credit limit for any time for any customer

View File

@ -17,10 +17,6 @@
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
var cp = wn.control_panel;
if(cp.country == 'India') $(cur_frm.fields_dict.tds.row.wrapper).toggle(true);
else $(cur_frm.fields_dict.tds.row.wrapper).toggle(false);
cur_frm.cscript.load_defaults(doc, cdt, cdn);
}
@ -28,6 +24,9 @@ cur_frm.cscript.refresh = function(doc) {
cur_frm.cscript.is_opening(doc)
erpnext.hide_naming_series();
cur_frm.cscript.voucher_type(doc);
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
}
}
cur_frm.cscript.load_defaults = function(doc, cdt, cdn) {
@ -50,9 +49,6 @@ cur_frm.cscript.load_defaults = function(doc, cdt, cdn) {
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
hide_field('aging_date');
if (doc.is_opening == 'Yes') unhide_field('aging_date');
if(doc.docstatus==1) { unhide_field('view_ledger_entry'); }
else hide_field('view_ledger_entry');
}
cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(doc) {
@ -93,12 +89,6 @@ cur_frm.fields_dict['entries'].grid.get_field('against_jv').get_query = function
and `tabJournal Voucher Detail`.parent = `tabJournal Voucher`.name";
}
// TDS Account Head
cur_frm.fields_dict['tax_code'].get_query = function(doc) {
return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50";
}
//Set debit and credit to zero on adding new row
//----------------------------------------------
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
@ -139,7 +129,6 @@ cur_frm.cscript.update_totals = function(doc) {
tc += flt(el[i].credit);
}
var doc = locals[doc.doctype][doc.name];
tc += flt(doc.ded_amount)
doc.total_debit = td;
doc.total_credit = tc;
doc.difference = flt(td - tc);
@ -148,12 +137,7 @@ cur_frm.cscript.update_totals = function(doc) {
cur_frm.cscript.debit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
cur_frm.cscript.credit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
cur_frm.cscript.ded_amount = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
cur_frm.cscript.rate = function(doc,dt,dn) {
doc.ded_amount = doc.total_debit*doc.rate/100;
refresh_field('ded_amount');
cur_frm.cscript.update_totals(doc);
}
cur_frm.cscript.get_balance = function(doc,dt,dn) {
cur_frm.cscript.update_totals(doc);
$c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
@ -179,15 +163,6 @@ cur_frm.cscript.validate = function(doc,cdt,cdn) {
cur_frm.cscript.update_totals(doc);
}
// TDS
// --------
cur_frm.cscript.get_tds = function(doc, dt, dn) {
$c_obj(make_doclist(dt,dn), 'get_tds', '', function(r, rt){
cur_frm.refresh();
cur_frm.cscript.update_totals(doc);
});
}
// ***************** Get Print Heading based on Sales Invoice *****************
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
@ -204,7 +179,6 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
cur_frm.pformat.print_heading = "Journal Voucher";
}
/****************** Get Accounting Entry *****************/
cur_frm.cscript.view_ledger_entry = function(doc,cdt,cdn){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}

View File

@ -69,8 +69,6 @@ class DocType:
if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() not in ['na', 'not applicable', 'none']:
bill_no = bill_no and bill_no[0]
r.append('%s %s against Bill %s dated %s' % (bill_no[2] and cstr(bill_no[2]) or '', fmt_money(flt(d.debit)), bill_no[0], bill_no[1] and formatdate(bill_no[1].strftime('%Y-%m-%d')) or ''))
if self.doc.ded_amount:
r.append("TDS Amount: %s" % self.doc.ded_amount)
if self.doc.user_remark:
r.append("User Remark : %s"%self.doc.user_remark)
@ -156,58 +154,7 @@ class DocType:
master_type = self.get_master_type(d.account)
if (master_type == 'Customer' and flt(d.credit) > 0) or (master_type == 'Supplier' and flt(d.debit) > 0):
msgprint("Message: Please check Is Advance as 'Yes' against Account %s if this is an advance entry." % d.account)
def get_tds_category_account(self):
for d in getlist(self.doclist,'entries'):
if flt(d.debit) > 0 and not d.against_voucher and d.is_advance == 'Yes':
acc = sql("select tds_applicable from `tabAccount` where name = '%s'" % d.account)
acc_tds_applicable = acc and acc[0][0] or 'No'
if acc_tds_applicable == 'Yes':
# TDS applicable field become mandatory for advance payment towards supplier or related party
if not self.doc.tds_applicable:
msgprint("Please select TDS Applicable or Not")
raise Exception
# If TDS applicable, category and supplier account bocome mandatory
elif self.doc.tds_applicable == 'Yes':
self.validate_category_account(d.account)
if self.doc.ded_amount and not self.doc.tax_code:
msgprint("Please enter Tax Code in TDS section")
raise Exception
#If TDS not applicable, all related fields should blank
else:
self.set_fields_null()
# If tds amount but tds applicability not mentioned in account master
elif self.doc.ded_amount:
msgprint("Please select TDS Applicable = 'Yes' in account head: '%s' if you want to deduct TDS." % self.doc.supplier_account)
raise Exception
def validate_category_account(self, credit_account):
if not self.doc.tds_category:
msgprint("Please select TDS Category")
raise Exception
if not self.doc.supplier_account:
self.doc.supplier_account = credit_account
elif self.doc.supplier_account and self.doc.supplier_account != credit_account:
msgprint("Supplier Account is not matching with the account mentioned in the table. Please select proper Supplier Account and click on 'Get TDS' button.")
raise Exception
def set_fields_null(self):
self.doc.ded_amount = 0
self.doc.rate = 0
self.doc.tax_code = ''
self.doc.tds_category = ''
self.doc.supplier_account = ''
def get_tds(self):
if cstr(self.doc.is_opening) != 'Yes':
if self.doc.total_debit > 0:
self.get_tds_category_account()
if self.doc.supplier_account and self.doc.tds_category:
get_obj('TDS Control').get_tds_amount(self)
def get_balance(self):
if not getlist(self.doclist,'entries'):
@ -238,9 +185,6 @@ class DocType:
self.doc.total_debit += flt(d.debit)
self.doc.total_credit += flt(d.credit)
if self.doc.tds_applicable == 'Yes':
self.doc.total_credit = flt(self.doc.total_credit) + flt(self.doc.ded_amount)
self.doc.difference = flt(self.doc.total_debit) - flt(self.doc.total_credit)
def get_against_account(self):
@ -254,10 +198,7 @@ class DocType:
if flt(d.credit)>0 and (d.account not in credit_list): credit_list.append(d.account)
self.doc.total_debit = debit
if self.doc.tds_applicable == 'Yes':
self.doc.total_credit = credit + flt(self.doc.ded_amount)
else:
self.doc.total_credit = credit
self.doc.total_credit = credit
if abs(self.doc.total_debit-self.doc.total_credit) > 0.001:
msgprint("Debit must be equal to Credit. The difference is %s" % (self.doc.total_debit-self.doc.total_credit))
@ -338,10 +279,7 @@ class DocType:
self.get_against_account()
self.validate_cheque_info()
self.create_remarks()
# tds
get_obj('TDS Control').validate_first_entry(self)
self.get_tds_category_account()
self.validate_entries_for_advance()
self.set_aging_date()
@ -378,11 +316,4 @@ class DocType:
raise Exception
def on_cancel(self):
self.check_tds_payment_voucher()
get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)
def check_tds_payment_voucher(self):
tdsp = sql("select parent from `tabTDS Payment Detail` where voucher_no = %s and docstatus = 1 and parent not like 'old%%'", self.doc.name)
if tdsp:
msgprint("TDS Payment voucher '%s' has been made against this voucher. Please cancel the payment voucher to proceed." % (tdsp and tdsp[0][0] or ''))
raise Exception
get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)

View File

@ -2,12 +2,13 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-10-16 12:29:32",
"creation": "2012-12-03 17:26:38",
"modified_by": "Administrator",
"modified": "2012-12-03 17:10:41"
"modified": "2012-12-04 18:47:42"
},
{
"is_submittable": 1,
"autoname": "naming_series:",
"name": "__common__",
"default_print_format": "Standard",
"search_fields": "voucher_type,posting_date, due_date, cheque_no",
@ -489,66 +490,6 @@
"fieldtype": "Data",
"permlevel": 1
},
{
"oldfieldtype": "Section Break",
"doctype": "DocField",
"options": "Simple",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"allow_on_submit": 1,
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "View Ledger Entry",
"trigger": "Client",
"fieldname": "view_ledger_entry",
"fieldtype": "Button",
"permlevel": 0
},
{
"print_hide": 0,
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "TDS",
"fieldname": "tds",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"permlevel": 0,
"no_copy": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "TDS Applicable",
"oldfieldname": "tds_applicable",
"default": "No",
"fieldname": "tds_applicable",
"fieldtype": "Select",
"search_index": 1,
"options": "\nYes\nNo",
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Select",
"colour": "White:FFF",
"doctype": "DocField",
"label": "TDS Category",
"oldfieldname": "tds_category",
"permlevel": 0,
"trigger": "Client",
"fieldname": "tds_category",
"fieldtype": "Select",
"search_index": 1,
"hidden": 0,
"options": "link:TDS Category",
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
@ -564,55 +505,6 @@
"hidden": 0,
"options": "Account"
},
{
"no_copy": 0,
"oldfieldtype": "Button",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Get TDS",
"trigger": "Client",
"fieldname": "get_tds",
"fieldtype": "Button",
"permlevel": 0
},
{
"print_hide": 1,
"description": "Tax Code will be populated based on account head mentioned in TDS Category master",
"no_copy": 1,
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "TDS Account Head",
"oldfieldname": "tax_code",
"permlevel": 0,
"fieldname": "tax_code",
"fieldtype": "Link",
"options": "Account"
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Rate",
"oldfieldname": "rate",
"trigger": "Client",
"fieldname": "rate",
"fieldtype": "Currency",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Amount",
"oldfieldname": "ded_amount",
"trigger": "Client",
"fieldname": "ded_amount",
"fieldtype": "Currency",
"permlevel": 0
},
{
"amend": 1,
"create": 1,

View File

@ -14,13 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
cur_frm.set_query("default_account", function(doc) {
return erpnext.queries.account({
account_type: "Bank or Cash",
company: doc.company
});
});

View File

@ -1,71 +1,71 @@
# DocType, Mode of Payment
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:44',
'docstatus': 0,
'modified': '2012-03-27 14:35:44',
'modified_by': u'Administrator',
'owner': u'harshada@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': u'field:mode_of_payment',
'colour': u'White:FFF',
'doctype': 'DocType',
'document_type': u'Master',
'module': u'Accounts',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'version': 3
},
# These values are common for all DocField
{
'doctype': u'DocField',
'fieldname': u'mode_of_payment',
'fieldtype': u'Data',
'label': u'Mode of Payment',
'name': '__common__',
'oldfieldname': u'mode_of_payment',
'oldfieldtype': u'Data',
'parent': u'Mode of Payment',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0,
'reqd': 1
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Mode of Payment',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'role': u'Accounts Manager',
'write': 1
},
# DocType, Mode of Payment
{
'doctype': 'DocType',
'name': u'Mode of Payment'
},
# DocPerm
{
'doctype': u'DocPerm'
},
# DocField
{
'doctype': u'DocField'
}
{
"owner": "harshada@webnotestech.com",
"docstatus": 0,
"creation": "2012-07-03 13:30:49",
"modified_by": "Administrator",
"modified": "2012-12-04 16:33:37"
},
{
"autoname": "field:mode_of_payment",
"name": "__common__",
"doctype": "DocType",
"module": "Accounts",
"document_type": "Master"
},
{
"name": "__common__",
"parent": "Mode of Payment",
"doctype": "DocField",
"parenttype": "DocType",
"permlevel": 0,
"parentfield": "fields"
},
{
"parent": "Mode of Payment",
"read": 1,
"cancel": 1,
"name": "__common__",
"amend": 0,
"create": 1,
"doctype": "DocPerm",
"submit": 0,
"write": 1,
"parenttype": "DocType",
"role": "Accounts Manager",
"permlevel": 0,
"parentfield": "permissions"
},
{
"name": "Mode of Payment",
"doctype": "DocType"
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Mode of Payment",
"oldfieldname": "mode_of_payment",
"fieldname": "mode_of_payment",
"fieldtype": "Data",
"reqd": 1
},
{
"doctype": "DocField",
"label": "Company",
"fieldname": "company",
"fieldtype": "Link",
"options": "Company"
},
{
"description": "Default Bank / Cash account will be automatically updated in POS Invoice when this mode is selected.",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Default Account",
"fieldname": "default_account",
"fieldtype": "Link",
"options": "Account"
},
{
"doctype": "DocPerm"
}
]

View File

@ -20,20 +20,11 @@ cur_frm.cscript.other_fname = "purchase_tax_details";
wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
// On Load
// --------
cur_frm.cscript.onload = function(doc,dt,dn) {
if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
tds_flds = ['tds','tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance'];
if(wn.control_panel.country == 'India') unhide_field(tds_flds);
else hide_field(tds_flds);
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
}
//Onload post render
//------------------------
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) {
var callback1 = function(doc, dt, dn) {
@ -46,8 +37,6 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
}
// Refresh
// --------
cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.clear_custom_buttons();
@ -67,7 +56,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
}
//Supplier
cur_frm.cscript.supplier = function(doc,dt,dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
@ -105,8 +93,6 @@ cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
@ -135,10 +121,6 @@ cur_frm.cscript.credit_to = function(doc,dt,dn) {
get_server_fields('get_cust', '', '', doc, dt, dn, 1, callback);
}
//Set expense_head and cost center on adding new row
//----------------------------------------------
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
@ -163,22 +145,16 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
}
cur_frm.cscript.write_off_amount = function(doc) {
doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.ded_amount) - flt(doc.write_off_amount);
doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.write_off_amount);
doc.outstanding_amount = flt(doc.total_amount_to_pay) - flt(doc.total_advance);
refresh_many(['outstanding_amount', 'total_amount_to_pay']);
}
// Recalculate Button
// -------------------
cur_frm.cscript.recalculate = function(doc, cdt, cdn) {
cur_frm.cscript.calculate_tax(doc,cdt,cdn);
calc_total_advance(doc,cdt,cdn);
}
// Get Items Button
// -----------------
cur_frm.cscript.get_items = function(doc, dt, dn) {
var callback = function(r,rt) {
unhide_field(['supplier_address', 'contact_person']);
@ -187,10 +163,6 @@ cur_frm.cscript.get_items = function(doc, dt, dn) {
$c_obj(make_doclist(dt,dn),'pull_details','',callback);
}
// ========== Purchase Invoice Items Table ============
// Item Code
// ----------
cur_frm.cscript.item_code = function(doc,cdt,cdn){
var d = locals[cdt][cdn];
if(d.item_code){
@ -198,49 +170,11 @@ cur_frm.cscript.item_code = function(doc,cdt,cdn){
}
}
// Rate in Deduct Taxes (TDS)
// --------------------------
cur_frm.cscript.rate = function(doc,dt,dn) {
//This is done as Purchase tax detail and PV detail both contain the same fieldname 'rate'
if(dt != 'Purchase Taxes and Charges') cur_frm.cscript.calc_amount(doc, 2);
}
// Amount
// -------
cur_frm.cscript.ded_amount = function(doc,dt,dn) {calculate_outstanding(doc);}
// Get TDS Button
// ---------------
cur_frm.cscript.get_tds = function(doc, dt, dn) {
var callback = function(r,rt) {
cur_frm.refresh();
refresh_field('ded_amount');
//cur_frm.cscript.calc_total(locals[dt][dn]);
}
$c_obj(make_doclist(dt,dn), 'get_tds', '', callback);
}
// ===================== Advance Allocation ==================
cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
var d = locals[cdt][cdn];
if (d.allocated_amount && d.tds_amount){
d.tds_allocated=flt(d.tds_amount*(d.allocated_amount/d.advance_amount))
refresh_field('tds_allocated', d.name, 'advance_allocation_details');
}
tot_tds=0
el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details')
for(var i in el){
tot_tds += el[i].tds_allocated
}
doc.tds_amount_on_advance = tot_tds
refresh_field('tds_amount_on_advance');
cur_frm.cscript.allocated_amount = function(doc,cdt,cdn) {
calc_total_advance(doc, cdt, cdn);
}
// Make Journal Voucher
// --------------------
cur_frm.cscript.make_bank_voucher = function() {
$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
if(!r.exc) {
@ -250,9 +184,6 @@ cur_frm.cscript.make_bank_voucher = function() {
}
/* ***************************** GET QUERY Functions *************************** */
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
@ -261,21 +192,14 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
// Item Code
// ----------
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
}
// Credit To
// ----------
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
}
// Purchase Order
// ---------------
cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) {
if (doc.supplier){
return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 100 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
@ -284,8 +208,6 @@ cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) {
}
}
// Purchase Receipt
// -----------------
cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) {
if (doc.supplier){
return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 100 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
@ -299,10 +221,6 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
}
// ================== Purchase Invoice Items Table ===================
// Expense Head
// -------------
cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
}
@ -317,9 +235,6 @@ cur_frm.cscript.expense_head = function(doc, cdt, cdn){
refresh_field('entries');
}
// Cost Center
//-------------
cur_frm.fields_dict['entries'].grid.get_field("cost_center").get_query = function(doc) {
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.docstatus != 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
}
@ -335,39 +250,21 @@ cur_frm.cscript.cost_center = function(doc, cdt, cdn){
refresh_field('entries');
}
// TDS Account Head
cur_frm.fields_dict['tax_code'].get_query = function(doc) {
return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50";
}
cur_frm.cscript.tax_code = function(doc, dt, dn) {
get_server_fields('get_tds_rate','','',doc, dt, dn, 0);
}
/* ***************************** UTILITY FUNCTIONS ************************ */
// Calculate Advance
// ------------------
calc_total_advance = function(doc,cdt,cdn) {
var doc = locals[doc.doctype][doc.name];
var el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details')
var tot_tds=0;
var total_advance = 0;
for(var i in el) {
if (! el[i].allocated_amount == 0) {
total_advance += flt(el[i].allocated_amount);
tot_tds += flt(el[i].tds_allocated)
}
}
doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.ded_amount) - flt(doc.write_off_amount);
doc.tds_amount_on_advance = flt(tot_tds);
doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.write_off_amount);
doc.total_advance = flt(total_advance);
doc.outstanding_amount = flt(doc.total_amount_to_pay) - flt(total_advance);
refresh_many(['total_advance','outstanding_amount','tds_amount_on_advance', 'total_amount_to_pay']);
refresh_many(['total_advance','outstanding_amount', 'total_amount_to_pay']);
}
// Make JV
// --------
cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
var jv = LocalDB.create('Journal Voucher');
jv = locals['Journal Voucher'][jv];
@ -392,7 +289,6 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
loaddoc('Journal Voucher', jv.name);
}
// ***************** Get project name *****************
cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
@ -409,7 +305,6 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
cur_frm.pformat.print_heading = "Purchase Invoice";
}
/****************** Get Accounting Entry *****************/
cur_frm.cscript.view_ledger_entry = function(){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}

View File

@ -244,8 +244,6 @@ class DocType(TransactionBase):
raise Exception , "Validation Error"
if not self.doc.remarks:
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s" % (self.doc.bill_no, formatdate(self.doc.bill_date)))
if self.doc.ded_amount:
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Grand Total: %s, Tax Deduction Amount: %s" %(self.doc.grand_total, self.doc.ded_amount))
else:
if not self.doc.remarks:
self.doc.remarks = "No Remarks"
@ -352,42 +350,6 @@ class DocType(TransactionBase):
msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " conversion_rate : " + cstr(data[0]['conversion_rate']) + " does not match with conversion_rate of current document.")
raise Exception
# Build tds table if applicable
#------------------------------
def get_tds(self):
if cstr(self.doc.is_opening) != 'Yes':
if not self.doc.credit_to:
msgprint("Please Enter Credit To account first")
raise Exception
else:
tds_applicable = sql("select tds_applicable from tabAccount where name = '%s'" % self.doc.credit_to)
if tds_applicable and cstr(tds_applicable[0][0]) == 'Yes':
if not self.doc.tds_applicable:
msgprint("Please enter whether TDS Applicable or not")
raise Exception
if self.doc.tds_applicable == 'Yes':
if not self.doc.tds_category:
msgprint("Please select TDS Category")
raise Exception
else:
get_obj('TDS Control').get_tds_amount(self)
self.doc.total_tds_on_voucher = self.doc.ded_amount
self.doc.total_amount_to_pay=flt(self.doc.grand_total) - flt(self.doc.ded_amount) - self.doc.write_off_amount
self.doc.outstanding_amount = self.doc.total_amount_to_pay - flt(self.doc.total_advance)
elif self.doc.tds_applicable == 'No':
self.doc.tds_category = ''
self.doc.tax_code = ''
self.doc.rate = 0
self.doc.ded_amount = 0
self.doc.total_tds_on_voucher = 0
# get tds rate
# -------------
def get_tds_rate(self):
return {'rate' : flt(webnotes.conn.get_value('Account', self.doc.tax_code, 'tax_rate'))}
# set aging date
#-------------------
def set_aging_date(self):
if self.doc.is_opening != 'Yes':
self.doc.aging_date = self.doc.posting_date
@ -452,11 +414,7 @@ class DocType(TransactionBase):
self.po_list.append(d.purchase_order)
if not d.purhcase_receipt in self.pr_list:
self.pr_list.append(d.purchase_receipt)
# tds
get_obj('TDS Control').validate_first_entry(self)
if not flt(self.doc.ded_amount):
self.get_tds()
self.doc.save()
if not self.doc.is_opening:
self.doc.is_opening = 'No'
@ -467,7 +425,8 @@ class DocType(TransactionBase):
self.set_against_expense_account()
#FY validation
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,
self.doc.posting_date,'Posting Date')
self.validate_write_off_account()
@ -477,10 +436,9 @@ class DocType(TransactionBase):
# get total in words
dcc = TransactionBase().get_company_currency(self.doc.company)
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
# ***************************** SUBMIT *****************************
# Check Ref Document docstatus
# -----------------------------
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
self.doc.grand_total_import)
def check_prev_docstatus(self):
for d in getlist(self.doclist,'entries'):
if d.purchase_order:
@ -495,7 +453,6 @@ class DocType(TransactionBase):
raise Exception , "Validation Error."
#--------------------------------------------------------------------
def update_against_document_in_jv(self):
"""
Links invoice and advance voucher:
@ -524,9 +481,6 @@ class DocType(TransactionBase):
get_obj('GL Control').reconcile_against_document(lst)
# On Submit
#--------------------------------------------------------------------
def on_submit(self):
self.check_prev_docstatus()
@ -547,38 +501,18 @@ class DocType(TransactionBase):
use_mapper = (self.doc.write_off_account and self.doc.write_off_amount and 'Purchase Invoice with write off' or ''))
# ********************************* CANCEL *********************************
# Check Next Document's docstatus
# --------------------------------
def check_next_docstatus(self):
submit_jv = sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_voucher = '%s' and t1.docstatus = 1" % (self.doc.name))
if submit_jv:
msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
raise Exception, "Validation Error."
# On Cancel
# ----------
def on_cancel(self):
self.check_next_docstatus()
# Check whether tds payment voucher has been created against this voucher
self.check_tds_payment_voucher()
self.make_gl_entries(is_cancel=1)
get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0)
# Check whether tds payment voucher has been created against this voucher
#---------------------------------------------------------------------------
def check_tds_payment_voucher(self):
tdsp = sql("select parent from `tabTDS Payment Detail` where voucher_no = '%s' and docstatus = 1 and parent not like 'old%'")
if tdsp:
msgprint("TDS Payment voucher '%s' has been made against this voucher. Please cancel the payment voucher to proceed." % (tdsp and tdsp[0][0] or ''))
raise Exception
# on update
def on_update(self):
pass

View File

@ -2,12 +2,13 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-11-28 11:26:17",
"creation": "2012-12-03 17:26:39",
"modified_by": "Administrator",
"modified": "2012-12-03 17:10:41"
"modified": "2012-12-04 17:15:28"
},
{
"is_submittable": 1,
"autoname": "naming_series:",
"allow_attach": 1,
"default_print_format": "Standard",
"search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount",
@ -612,95 +613,6 @@
"fieldtype": "Table",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "TDS",
"fieldname": "tds",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break5",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "TDS Applicable",
"oldfieldname": "tds_applicable",
"options": "\nYes\nNo",
"fieldname": "tds_applicable",
"fieldtype": "Select",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "TDS Category",
"oldfieldname": "tds_category",
"options": "link:TDS Category",
"fieldname": "tds_category",
"fieldtype": "Select",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Button",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Get TDS",
"trigger": "Client",
"fieldname": "get_tds",
"fieldtype": "Button",
"permlevel": 0
},
{
"print_hide": 1,
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break6",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "TDS Account Head",
"oldfieldname": "tax_code",
"options": "Account",
"fieldname": "tax_code",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Rate",
"oldfieldname": "rate",
"fieldname": "rate",
"fieldtype": "Currency",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "TDS Amount",
"oldfieldname": "ded_amount",
"fieldname": "ded_amount",
"fieldtype": "Currency",
"permlevel": 0
},
{
"oldfieldtype": "Section Break",
"doctype": "DocField",
@ -760,29 +672,6 @@
"fieldtype": "Data",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Total TDS On Voucher",
"oldfieldname": "total_tds_on_voucher",
"fieldname": "total_tds_on_voucher",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Currency",
"colour": "White:FFF",
"doctype": "DocField",
"label": "TDS Amount On Advance",
"oldfieldname": "tds_amount_on_advance",
"fieldname": "tds_amount_on_advance",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Column Break",
@ -809,7 +698,7 @@
"no_copy": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Total Advance (Incl. TDS)",
"label": "Total Advance",
"oldfieldname": "total_advance",
"fieldname": "total_advance",
"fieldtype": "Currency",

View File

@ -1,134 +1,82 @@
# DocType, Purchase Invoice Advance
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:40',
'docstatus': 0,
'modified': '2012-03-27 14:35:40',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 20
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Purchase Invoice Advance',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# DocType, Purchase Invoice Advance
{
'doctype': 'DocType',
'name': u'Purchase Invoice Advance'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'journal_voucher',
'fieldtype': u'Link',
'label': u'Journal Voucher',
'no_copy': 1,
'oldfieldname': u'journal_voucher',
'oldfieldtype': u'Link',
'options': u'Journal Voucher',
'permlevel': 1,
'width': u'180px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'jv_detail_no',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Journal Voucher Detail No',
'no_copy': 1,
'oldfieldname': u'jv_detail_no',
'oldfieldtype': u'Date',
'permlevel': 1,
'print_hide': 1,
'width': u'80px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'advance_amount',
'fieldtype': u'Currency',
'label': u'Advance Amount',
'no_copy': 1,
'oldfieldname': u'advance_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'allocated_amount',
'fieldtype': u'Currency',
'label': u'Allocated Amount',
'no_copy': 1,
'oldfieldname': u'allocated_amount',
'oldfieldtype': u'Currency',
'permlevel': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_amount',
'fieldtype': u'Currency',
'label': u'TDS Amount',
'oldfieldname': u'tds_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'width': u'80px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_allocated',
'fieldtype': u'Currency',
'label': u'TDS Allocated',
'oldfieldname': u'tds_allocated',
'oldfieldtype': u'Currency',
'permlevel': 1,
'width': u'80px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'remarks',
'fieldtype': u'Small Text',
'label': u'Remarks',
'no_copy': 1,
'oldfieldname': u'remarks',
'oldfieldtype': u'Small Text',
'permlevel': 1,
'width': u'150px'
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-03 13:29:54",
"modified_by": "Administrator",
"modified": "2012-12-04 17:19:38"
},
{
"istable": 1,
"name": "__common__",
"doctype": "DocType",
"module": "Accounts"
},
{
"name": "__common__",
"parent": "Purchase Invoice Advance",
"no_copy": 1,
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "Purchase Invoice Advance",
"doctype": "DocType"
},
{
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Journal Voucher",
"oldfieldname": "journal_voucher",
"width": "180px",
"options": "Journal Voucher",
"fieldname": "journal_voucher",
"fieldtype": "Link",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Journal Voucher Detail No",
"oldfieldname": "jv_detail_no",
"width": "80px",
"fieldname": "jv_detail_no",
"fieldtype": "Date",
"hidden": 1,
"permlevel": 1
},
{
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Advance Amount",
"oldfieldname": "advance_amount",
"width": "100px",
"fieldname": "advance_amount",
"fieldtype": "Currency",
"permlevel": 1
},
{
"oldfieldtype": "Currency",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Allocated Amount",
"oldfieldname": "allocated_amount",
"width": "100px",
"trigger": "Client",
"fieldname": "allocated_amount",
"fieldtype": "Currency",
"permlevel": 0
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Remarks",
"oldfieldname": "remarks",
"width": "150px",
"fieldname": "remarks",
"fieldtype": "Small Text",
"permlevel": 1
}
]

View File

@ -148,6 +148,12 @@ cur_frm.cscript.is_pos = function(doc,dt,dn,callback){
}
}
cur_frm.cscript.mode_of_payment = function(doc) {
cur_frm.call({
method: "get_bank_cash_account",
args: { mode_of_payment: doc.mode_of_payment }
});
}
cur_frm.cscript.update_stock = function(doc, dt, dn) {
cur_frm.cscript.hide_fields(doc, dt, dn);
@ -387,9 +393,9 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
// Income Account in Details Table
// --------------------------------
cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Credit" OR tabAccount.account_type = "Income Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
}
cur_frm.set_query("income_account", "entries", function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Credit" OR tabAccount.account_type = "Income Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
})
// warehouse in detail table
//----------------------------

View File

@ -322,7 +322,6 @@ class DocType(TransactionBase):
if res:
get_obj('DocType Mapper', 'Project-Sales Invoice').dt_map('Project', 'Sales Invoice', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Invoice']]")
def get_company_abbr(self):
return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
@ -899,3 +898,11 @@ def assign_task_to_owner(inv, msg, users):
}
assign_to.add(args)
@webnotes.whitelist()
def get_bank_cash_account(mode_of_payment):
val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
if not val:
webnotes.msgprint("Default Account not set in Mode of Payment: ")
return {
"cash_bank_account": val
}

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,26 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}

View File

@ -1,33 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.model import db_exists
from webnotes.model.wrapper import copy_doclist
sql = webnotes.conn.sql
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
self.doclist = doclist
def validate(self):
self.doc.module = 'Accounts'

View File

@ -1,135 +0,0 @@
# DocType, TDS Category
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:48',
'docstatus': 0,
'modified': '2012-03-27 14:35:48',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1302586171',
'autoname': u'field:category_name',
'colour': u'White:FFF',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 0,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 8
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'TDS Category',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'TDS Category',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1
},
# DocType, TDS Category
{
'doctype': 'DocType',
'name': u'TDS Category'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 1,
'doctype': u'DocPerm',
'role': u'Accounts Manager',
'submit': 0,
'write': 1
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'role': u'System Manager',
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocField
{
'default': u'Accounts',
'doctype': u'DocField',
'fieldname': u'module',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 0,
'label': u'Module',
'oldfieldname': u'module',
'oldfieldtype': u'Link',
'options': u'Module Def',
'print_hide': 0,
'report_hide': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'note_html',
'fieldtype': u'HTML',
'label': u'Note HTML',
'oldfieldtype': u'HTML',
'options': u'<b>Note:</b> You must first create the Accounts from the Chart of Accounts and then link it to this Category.'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'category_name',
'fieldtype': u'Data',
'label': u'Category Name',
'oldfieldname': u'category_name',
'oldfieldtype': u'Data',
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_sh_edu_cess_account',
'fieldtype': u'Table',
'label': u'TDS Account Detail',
'oldfieldname': u'tds_sh_edu_cess_account',
'oldfieldtype': u'Table',
'options': u'TDS Category Account',
'reqd': 0
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,65 +0,0 @@
# DocType, TDS Category Account
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:48',
'docstatus': 0,
'modified': '2012-03-27 14:35:48',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'istable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 2
},
# These values are common for all DocField
{
'doctype': u'DocField',
'fieldtype': u'Link',
'name': '__common__',
'oldfieldtype': u'Link',
'parent': u'TDS Category Account',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0,
'reqd': 1
},
# DocType, TDS Category Account
{
'doctype': 'DocType',
'name': u'TDS Category Account'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'company',
'in_filter': 1,
'label': u'Company',
'oldfieldname': u'company',
'options': u'Company',
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'account_head',
'label': u'Account Head',
'oldfieldname': u'account_head',
'options': u'Account'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,123 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt, getdate
from webnotes.model import db_exists
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes import msgprint
sql = webnotes.conn.sql
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
# ============TDS==================
# Stop payable voucher on which tds is applicable is made before posting date of the
# voucher in which tds was applicable for 1st time
def validate_first_entry(self,obj):
if obj.doc.doctype == 'Purchase Invoice':
supp_acc = obj.doc.credit_to
elif obj.doc.doctype == 'Journal Voucher':
supp_acc = obj.doc.supplier_account
if obj.doc.ded_amount:
# first pv
first_pv = sql("select posting_date from `tabPurchase Invoice` where credit_to = '%s' and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
first_pv_date = first_pv and first_pv[0][0] or ''
# first jv
first_jv = sql("select posting_date from `tabJournal Voucher` where supplier_account = '%s'and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
first_jv_date = first_jv and first_jv[0][0] or ''
#first tds voucher date
first_tds_date = ''
if first_pv_date and first_jv_date:
first_tds_date = first_pv_date < first_jv_date and first_pv_date or first_jv_date
elif first_pv_date:
first_tds_date = first_pv_date
elif first_jv_date:
first_tds_date = first_jv_date
if first_tds_date and getdate(obj.doc.posting_date) < first_tds_date:
msgprint("First tds voucher for this category has been made already. Hence payable voucher cannot be made before posting date of first tds voucher ")
raise Exception
# TDS function definition
#---------------------------
def get_tds_amount(self, obj):
# Validate if posting date b4 first tds entry for this category
self.validate_first_entry(obj)
# get current amount and supplier head
if obj.doc.doctype == 'Purchase Invoice':
supplier_account = obj.doc.credit_to
total_amount=flt(obj.doc.grand_total)
for d in getlist(obj.doclist,'advance_allocation_details'):
if flt(d.tds_amount)!=0:
total_amount -= flt(d.allocated_amount)
elif obj.doc.doctype == 'Journal Voucher':
supplier_account = obj.doc.supplier_account
total_amount = obj.doc.total_debit
if obj.doc.tds_category:
# get total billed
total_billed = 0
pv = sql("select sum(ifnull(grand_total,0)), sum(ifnull(ded_amount,0)) from `tabPurchase Invoice` where tds_category = %s and credit_to = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
jv = sql("select sum(ifnull(total_debit,0)), sum(ifnull(ded_amount,0)) from `tabJournal Voucher` where tds_category = %s and supplier_account = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
tds_in_pv = pv and pv[0][1] or 0
tds_in_jv = jv and jv[0][1] or 0
total_billed += flt(pv and pv[0][0] or 0)+flt(jv and jv[0][0] or 0)+flt(total_amount)
# get slab
slab = sql("SELECT * FROM `tabTDS Rate Detail` t1, `tabTDS Rate Chart` t2 WHERE t1.category = '%s' AND t1.parent=t2.name and t2.applicable_from <= '%s' ORDER BY t2.applicable_from DESC LIMIT 1" % (obj.doc.tds_category, obj.doc.posting_date), as_dict = 1)
if slab and flt(slab[0]['slab_from']) <= total_billed:
if flt(tds_in_pv) <= 0 and flt(tds_in_jv) <= 0:
total_amount = total_billed
slab = slab[0]
# special tds rate
special_tds = sql("select special_tds_rate, special_tds_limit, special_tds_rate_applicable from `tabTDS Detail` where parent = '%s' and tds_category = '%s'"% (supplier_account,obj.doc.tds_category))
# get_pan_number
pan_no = sql("select pan_number from `tabAccount` where name = '%s'" % supplier_account)
pan_no = pan_no and cstr(pan_no[0][0]) or ''
if not pan_no and flt(slab.get('rate_without_pan')):
msgprint("As there is no PAN number mentioned in the account head: %s, TDS amount will be calculated at rate %s%%" % (supplier_account, cstr(slab['rate_without_pan'])))
tds_rate = flt(slab.get('rate_without_pan'))
elif special_tds and special_tds[0][2]=='Yes' and (flt(special_tds[0][1])==0 or flt(special_tds[0][1]) >= flt(total_amount)):
tds_rate = flt(special_tds[0][0])
else:
tds_rate=flt(slab['rate'])
# calculate tds amount
if flt(slab['rate']):
ac = sql("SELECT account_head FROM `tabTDS Category Account` where parent=%s and company=%s", (obj.doc.tds_category,obj.doc.company))
if ac:
obj.doc.tax_code = ac[0][0]
obj.doc.rate = tds_rate
obj.doc.ded_amount = round(flt(tds_rate) * flt(total_amount) / 100)
else:
msgprint("TDS Account not selected in TDS Category %s" % (obj.doc.tds_category))
raise Exception

View File

@ -1,31 +0,0 @@
# DocType, TDS Control
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:48',
'docstatus': 0,
'modified': '2012-03-27 14:35:48',
'modified_by': u'Administrator',
'owner': u'wasim@webnotestech.com'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 36
},
# DocType, TDS Control
{
'doctype': 'DocType',
'name': u'TDS Control'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,108 +0,0 @@
# DocType, TDS Detail
[
# These values are common in all dictionaries
{
u'creation': '2012-07-03 13:29:51',
u'docstatus': 0,
u'modified': '2012-09-17 11:08:28',
u'modified_by': u'Administrator',
u'owner': u'wasim@webnotestech.com'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
u'doctype': u'DocType',
'istable': 1,
'module': u'Accounts',
u'name': u'__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'TDS Detail',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0,
'width': u'150px'
},
# These values are common for all DocPerm
{
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'TDS Detail',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'System Manager'
},
# DocType, TDS Detail
{
u'doctype': u'DocType',
u'name': u'TDS Detail'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'tds_category',
'fieldtype': u'Select',
'label': u'TDS Category',
'oldfieldname': u'tds_category',
'oldfieldtype': u'Select',
'options': u'link:TDS Category'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'special_tds_rate_applicable',
'fieldtype': u'Select',
'label': u'Special TDS Rate Applicable',
'oldfieldname': u'special_tds_rate_applicable',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'special_tds_rate',
'fieldtype': u'Currency',
'label': u'Special TDS Rate(Section-197)\t',
'oldfieldname': u'special_tds_rate',
'oldfieldtype': u'Currency'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'special_tds_limit',
'fieldtype': u'Currency',
'label': u'Special TDS Limit',
'oldfieldname': u'special_tds_limit',
'oldfieldtype': u'Currency'
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,91 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.cscript.onload = function(doc,cdt,cdn){
cur_frm.cscript.refresh(doc, cdt, cdn);
}
// get pan and tan no
cur_frm.cscript.company = function(doc,cdt,cdn){
if(doc.company) get_server_fields('get_registration_details','','',doc,cdt,cdn);
}
// check
cur_frm.cscript.to_date = function(doc,cdt,cdn){
if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
alert("From date can not be greater than To date");
doc.to_date='';
refresh_field('to_date');
}
}
cur_frm.cscript.from_date = function(doc,cdt,cdn){
if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
alert("From date can not be greater than To date");
doc.from_date='';
refresh_field('from_date');
}
}
// Make Journal Voucher
// --------------------
cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {
var call_back = function(r,rt) {
cur_frm.cscript.make_jv(doc,dt,dn,r.message);
}
// get def bank and tds account
$c_obj(make_doclist(dt, dn), 'get_bank_and_tds_account', '', call_back);
}
cur_frm.cscript.make_jv = function(doc, dt, dn, det) {
var jv = LocalDB.create('Journal Voucher');
jv = locals['Journal Voucher'][jv];
jv.voucher_type = 'Bank Voucher';
jv.voucher_date = dateutil.obj_to_str(new Date());
jv.posting_date = dateutil.obj_to_str(new Date());
jv.aging_date = dateutil.obj_to_str(new Date());
jv.remark = repl('Payment against voucher %(vn)s. %(rem)s', {vn:doc.name, rem:doc.remarks});
jv.total_debit = doc.total_tds;
jv.total_credit = doc.total_tds;
jv.fiscal_year = sys_defaults.fiscal_year;
jv.company = doc.company;
// debit to tds account
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
d1.account = det.tds_account;
d1.debit = doc.total_tds;
// credit to bank account
var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
d2.account = det.bank_account;
d2.credit = doc.total_tds;
loaddoc('Journal Voucher', jv.name);
}
// Show / Hide button
cur_frm.cscript.refresh = function(doc, dt, dn) {
if(doc.docstatus==1) {
unhide_field('make_bank_voucher');
unhide_field('update');
}
else {
hide_field('make_bank_voucher');
hide_field('update');
}
}

View File

@ -1,119 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt, now
from webnotes.model import db_exists
from webnotes.model.doc import addchild, make_autoname
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes import msgprint
sql = webnotes.conn.sql
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d, dl
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.####')
# Get pan and tan no from company
#---------------------------------
def get_registration_details(self):
comp_det=sql("Select registration_details from `tabCompany` where name = '%s'"%(self.doc.company))
if not comp_det:
msgprint("Registration Details is not mentioned in comapny")
ret = {'registration_details': ''}
else:
ret = { 'registration_details': cstr(comp_det[0][0])}
return ret
# Get default bank and tds account
#------------------------------------
def get_bank_and_tds_account(self):
tds_account=sql("Select account_head from `tabTDS Category Account` where parent='%s' and company='%s'"%(self.doc.tds_category,self.doc.company))
tds_account = tds_account and tds_account[0][0] or ''
def_bank = sql("select default_bank_account from tabCompany where name = '%s'" % self.doc.company)
def_bank = def_bank and def_bank[0][0] or ''
ret = {'tds_account':tds_account, 'bank_account': def_bank}
return ret
# Fetch voucherwise tds details
#-------------------------------
def get_tds_list(self):
self.doclist = self.doc.clear_table(self.doclist,'tds_payment_details')
self.doc.total_tds = 0
import datetime
if not self.doc.tds_category:
msgprint("Please select tds category")
else:
if not self.doc.from_date or not self.doc.to_date:
msgprint("Please enter from date and to date")
else:
idx = 1
pv_det= sql("Select name,credit_to,grand_total,posting_date, ded_amount from `tabPurchase Invoice` where tds_category='%s' And posting_date>= '%s' And posting_date <='%s' and docstatus=1 and ded_amount > 0 Order By posting_date"%(self.doc.tds_category,self.doc.from_date,self.doc.to_date))
if pv_det:
idx = self.make_tds_table(pv_det, idx)
jv_det= sql("Select name, supplier_account, total_debit,posting_date, ded_amount from `tabJournal Voucher` where tds_category='%s' And posting_date<= '%s' And posting_date >='%s' And docstatus=1 and ded_amount > 0 Order By posting_date"%(self.doc.tds_category,self.doc.to_date,self.doc.from_date))
if jv_det:
self.make_tds_table(jv_det, idx)
# Create TDS table
#------------------
def make_tds_table(self,det, idx):
for v in det:
if not sql("select name from `tabTDS Payment Detail` where voucher_no = '%s' and parent != '%s' and docstatus = 1" % (v[0], self.doc.name)):
child = addchild(self.doc, 'tds_payment_details', 'TDS Payment Detail', 1, self.doclist)
child.voucher_no = v and v[0] or ''
child.party_name = v and v[1] or ''
child.amount_paid = v and flt(v[2]) or ''
child.date_of_payment =v and v[3].strftime('%Y-%m-%d') or ''
child.tds_amount = v and flt(v[4]) or 0
child.cess_on_tds = 0
child.total_tax_amount = child.tds_amount + child.cess_on_tds
child.idx=idx
idx=idx+1
self.doc.total_tds= flt(self.doc.total_tds)+flt(child.total_tax_amount)
return idx
# Update acknowledgement details
#---------------------------------------
def update_ack_details(self):
sql("update `tabTDS Payment` set cheque_no = '%s', bsr_code = '%s', date_of_receipt = '%s', challan_id = '%s' where name = '%s'" % (self.doc.cheque_no, self.doc.bsr_code, self.doc.date_of_receipt, self.doc.challan_id, self.doc.name))
# Validate
#------------------
def validate(self):
if self.doc.amended_from and not self.doc.amendment_date:
msgprint("Please Enter Amendment Date")
raise Exception
self.calculate_total_tds()
def calculate_total_tds(self):
total = 0
for d in getlist(self.doclist,'tds_payment_details'):
total = flt(total)+flt(d.total_tax_amount)
self.doc.total_tds = total

View File

@ -1,434 +0,0 @@
# DocType, TDS Payment
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:48',
'docstatus': 0,
'modified': '2012-03-27 14:45:52',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'in_create': 0,
'is_submittable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 224
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'TDS Payment',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'TDS Payment',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, TDS Payment
{
'doctype': 'DocType',
'name': u'TDS Payment'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'All'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'from_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'From Date',
'oldfieldname': u'from_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'to_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'To Date',
'oldfieldname': u'to_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'tds_category',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'TDS Category',
'oldfieldname': u'tds_category',
'oldfieldtype': u'Link',
'options': u'TDS Category',
'permlevel': 0,
'reqd': 1,
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break1',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'description': u'To manage multiple series please go to Setup > Series Setup',
'doctype': u'DocField',
'fieldname': u'naming_series',
'fieldtype': u'Select',
'label': u'Naming Series',
'no_copy': 1,
'oldfieldname': u'naming_series',
'oldfieldtype': u'Select',
'options': u'TDSP',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'fiscal_year',
'fieldtype': u'Select',
'in_filter': 1,
'label': u'Fiscal Year',
'oldfieldname': u'fiscal_year',
'oldfieldtype': u'Select',
'options': u'link:Fiscal Year',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amended_from',
'fieldtype': u'Data',
'label': u'Amended From',
'no_copy': 1,
'oldfieldname': u'amended_from',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'description': u'The date at which current entry is corrected in the system.',
'doctype': u'DocField',
'fieldname': u'amendment_date',
'fieldtype': u'Date',
'label': u'Amendment Date',
'no_copy': 1,
'oldfieldname': u'amendment_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break2',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'company',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Company',
'oldfieldname': u'company',
'oldfieldtype': u'Link',
'options': u'Company',
'permlevel': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'registration_details',
'fieldtype': u'Small Text',
'label': u'Registration Details',
'oldfieldname': u'registration_details',
'oldfieldtype': u'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'remarks',
'fieldtype': u'Small Text',
'label': u'Remark',
'no_copy': 1,
'oldfieldname': u'remarks',
'oldfieldtype': u'Small Text',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break3',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'html0',
'fieldtype': u'HTML',
'oldfieldtype': u'HTML',
'options': u'<b>Please Update Cheque No., BSR Code, Challan ID no. after actual payment. Unless you do not get it in Form 16A.</b>',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'cheque_no',
'fieldtype': u'Data',
'label': u'Cheque / DD No.',
'oldfieldname': u'cheque_no',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'bsr_code',
'fieldtype': u'Data',
'label': u'BSR Code',
'oldfieldname': u'bsr_code',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'date_of_receipt',
'fieldtype': u'Date',
'label': u'Date of Receipt',
'oldfieldname': u'date_of_receipt',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'challan_id',
'fieldtype': u'Data',
'label': u'Challan ID',
'oldfieldname': u'challan_id',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'update',
'fieldtype': u'Button',
'label': u'Update',
'oldfieldtype': u'Button',
'options': u'update_ack_details',
'permlevel': 0,
'report_hide': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break1',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'get_tds_list',
'fieldtype': u'Button',
'label': u'Get TDS List',
'oldfieldtype': u'Button',
'options': u'get_tds_list',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_payment_details',
'fieldtype': u'Table',
'label': u'TDS Payment Details',
'oldfieldname': u'tds_payment_details',
'oldfieldtype': u'Table',
'options': u'TDS Payment Detail',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break2',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'total_tds',
'fieldtype': u'Currency',
'label': u'Total TDS',
'oldfieldname': u'total_tds',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'make_bank_voucher',
'fieldtype': u'Button',
'label': u'Make Bank Voucher',
'oldfieldtype': u'Button',
'permlevel': 0,
'trigger': u'Client'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,111 +0,0 @@
# DocType, TDS Payment Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:49',
'docstatus': 0,
'modified': '2012-03-27 14:35:49',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 11
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'TDS Payment Detail',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, TDS Payment Detail
{
'doctype': 'DocType',
'name': u'TDS Payment Detail'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'voucher_no',
'fieldtype': u'Data',
'label': u'Voucher No',
'oldfieldname': u'voucher_no',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'party_name',
'fieldtype': u'Data',
'label': u'Party Name',
'oldfieldname': u'party_name',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amount_paid',
'fieldtype': u'Currency',
'label': u'Amount paid / credited',
'oldfieldname': u'amount_paid',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'date_of_payment',
'fieldtype': u'Date',
'label': u'Date of payment / credit',
'oldfieldname': u'date_of_payment',
'oldfieldtype': u'Date'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_amount',
'fieldtype': u'Currency',
'label': u'TDS',
'oldfieldname': u'tds_amount',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cess_on_tds',
'fieldtype': u'Currency',
'label': u'Cess on TDS',
'oldfieldname': u'cess_on_tds',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'total_tax_amount',
'fieldtype': u'Currency',
'label': u'Total Tax Amount',
'oldfieldname': u'total_tax_amount',
'oldfieldtype': u'Currency'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,121 +0,0 @@
# DocType, TDS Rate Chart
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:49',
'docstatus': 0,
'modified': '2012-03-27 14:35:49',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'autoname': u'Prompt',
'colour': u'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'module': u'Accounts',
'name': '__common__',
'read_only': 0,
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 11
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'TDS Rate Chart',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'TDS Rate Chart',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1
},
# DocType, TDS Rate Chart
{
'doctype': 'DocType',
'name': u'TDS Rate Chart'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'role': u'Accounts Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'role': u'System Manager',
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocField
{
'default': u'Accounts',
'doctype': u'DocField',
'fieldname': u'module',
'fieldtype': u'Link',
'hidden': 1,
'label': u'Module',
'oldfieldname': u'module',
'oldfieldtype': u'Link',
'options': u'Module Def',
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'applicable_from',
'fieldtype': u'Date',
'label': u'Applicable From',
'oldfieldname': u'applicable_from',
'oldfieldtype': u'Date',
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rate_chart_detail',
'fieldtype': u'Table',
'label': u'Rate Chart Detail',
'oldfieldname': u'rate_chart_detail',
'oldfieldtype': u'Table',
'options': u'TDS Rate Detail'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,84 +0,0 @@
# DocType, TDS Rate Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:49',
'docstatus': 0,
'modified': '2012-03-27 14:35:49',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 7
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'TDS Rate Detail',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, TDS Rate Detail
{
'doctype': 'DocType',
'name': u'TDS Rate Detail'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'category',
'fieldtype': u'Link',
'label': u'Category',
'oldfieldname': u'category',
'oldfieldtype': u'Link',
'options': u'TDS Category',
'width': u'200px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'slab_from',
'fieldtype': u'Currency',
'label': u'Slab From',
'oldfieldname': u'slab_from',
'oldfieldtype': u'Currency'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rate',
'fieldtype': u'Currency',
'label': u'Rate',
'oldfieldname': u'rate',
'oldfieldtype': u'Currency',
'width': u'50px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rate_without_pan',
'fieldtype': u'Currency',
'label': u'Rate without PAN',
'oldfieldname': u'rate_without_pan',
'oldfieldtype': u'Currency'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,20 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.fields_dict['quarter'].get_query = function(doc, cdt, cdn) {
if(doc.fiscal_year)
return 'SELECT `tabPeriod`.name FROM `tabPeriod` WHERE `tabPeriod`.fiscal_year = "'+doc.fiscal_year+'" AND `tabPeriod`.period_type = "Quarter" AND `tabPeriod`.docstatus != 2 AND `tabPeriod`.name LIKE "%s" ORDER BY `tabPeriod`.start_date ASC LIMIT 50';
}

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,121 +0,0 @@
# DocType, TDS Return Acknowledgement
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:49',
'docstatus': 0,
'modified': '2012-03-27 14:35:49',
'modified_by': u'Administrator',
'owner': u'nabin@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': u'TDSR/.####',
'colour': u'White:FFF',
'doctype': 'DocType',
'module': u'Accounts',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'version': 13
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'TDS Return Acknowledgement',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0,
'reqd': 1
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'TDS Return Acknowledgement',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, TDS Return Acknowledgement
{
'doctype': 'DocType',
'name': u'TDS Return Acknowledgement'
},
# DocPerm
{
'doctype': u'DocPerm',
'role': u'Accounts User'
},
# DocPerm
{
'doctype': u'DocPerm',
'role': u'Accounts Manager'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'fiscal_year',
'fieldtype': u'Select',
'label': u'Fiscal Year',
'oldfieldname': u'fiscal_year',
'oldfieldtype': u'Select',
'options': u'link:Fiscal Year'
},
# DocField
{
'allow_on_submit': 0,
'doctype': u'DocField',
'fieldname': u'quarter',
'fieldtype': u'Select',
'label': u'Quarter',
'oldfieldname': u'quarter',
'oldfieldtype': u'Select',
'options': u'\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar',
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tds_category',
'fieldtype': u'Select',
'label': u'TDS Category',
'oldfieldname': u'tds_category',
'oldfieldtype': u'Select',
'options': u'link:TDS Category'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'acknowledgement_no',
'fieldtype': u'Data',
'label': u'Acknowledgement No',
'oldfieldname': u'acknowledgement_no',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'date_of_receipt',
'fieldtype': u'Date',
'label': u'Date of Receipt',
'oldfieldname': u'date_of_receipt',
'oldfieldtype': u'Date'
}
]

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,37 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
this.hide_all_filters();
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'Company'].df.filter_hide = 0;
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'TDS Category'].df.filter_hide = 0;
this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'TDS Payment'});
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'From Date'].df.in_first_page = 1;
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'To Date'].df.in_first_page = 1;
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'Company'].df.in_first_page = 1;
this.filter_fields_dict['TDS Payment'+FILTER_SEP +'TDS Category'].df.in_first_page = 1;
}
this.mytabs.items['Select Columns'].hide();
this.mytabs.items['More Filters'].hide();

View File

@ -1,51 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
if not filter_values.get('tds_category'):
msgprint("Please enter TDS Category")
raise Exception
l = [
['ID','150px','Link','TDS Payment'],
['Challan ID No.','100px','Data',''],
['Party Name','200px','Link','Account'],
['Amount paid / credited','100px','Currency',''],
['Date of payment / credit','100px','Date',''],
['TDS','100px','Currency',''],
['Cess on TDS','100px','Currency',''],
['Total Tax Amount','100px','Currency',''],
['PAN of the deductee','100px','Data',''],
['Total Tax Deposited','100px','Currency',''],
['Date of Deduction','100px','Date',''],
['Rate at which deducted','100px','Currency',''],
['Reason for Non-deduction / Lower deduction','100px','Data',''],
['Grossing up indicator','100px','Data',''],
['Deductee Code','100px','Data',''],
['Mode','100px','Data','']
]
for i in l:
colnames.append(i[0])
colwidths.append(i[1])
coltypes.append(i[2])
coloptions.append(i[3])
col_idx[i[0]] = len(colnames)-1
for r in res:
r.append(r[col_idx['Total Tax Amount']])
for i in range(0,6):
r.append('')

View File

@ -1,10 +0,0 @@
SELECT `tabTDS Payment`.`name`,`tabTDS Payment`.`challan_no`,`tabTDS Payment Detail`.`party_name`,`tabTDS Payment Detail`.`amount_paid`,`tabTDS Payment Detail`.`date_of_payment`,`tabTDS Payment Detail`.`tds_amount`,`tabTDS Payment Detail`.`cess_on_tds`,`tabTDS Payment Detail`.`total_tax_amount`,(`tabAccount`.pan_number) AS 'PAN of the deductee'
FROM `tabTDS Payment Detail`,`tabTDS Payment`,`tabAccount`
WHERE `tabTDS Payment`.docstatus = 1
AND `tabTDS Payment`.`company` LIKE '%(company)s%%'
AND `tabTDS Payment`.`tds_category` LIKE '%(tds_category)s%%'
AND `tabTDS Payment`.`from_date`>='%(transaction_date)s'
AND `tabTDS Payment`.`to_date`<='%(transaction_date1)s'
AND `tabAccount`.name = `tabTDS Payment Detail`.party_name
AND `tabTDS Payment Detail`.`parent` = `tabTDS Payment`.`name`
ORDER BY `PAN of the deductee` DESC

View File

@ -1,31 +0,0 @@
# Search Criteria, tds_return
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:53',
'docstatus': 0,
'modified': '2012-04-03 12:49:53',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Search Criteria
{
'criteria_name': u'TDS Return',
'dis_filters': u'fiscal_year',
'doc_type': u'TDS Payment Detail',
'doctype': 'Search Criteria',
'filters': u"{'TDS Payment\x01Submitted':1}",
'module': u'Accounts',
'name': '__common__',
'parent_doc_type': u'TDS Payment',
'standard': u'Yes'
},
# Search Criteria, tds_return
{
'doctype': 'Search Criteria',
'name': u'tds_return'
}
]

View File

@ -95,12 +95,9 @@ var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
cur_frm.fields_dict['conversion_rate'].label_area.innerHTML = "Conversion Rate (" + doc.currency +' -> '+ base_curr + ')';
if (doc.doctype == 'Purchase Invoice') {
cur_frm.fields_dict['total_tds_on_voucher'].label_area.innerHTML = 'Total TDS On Voucher (' + base_curr + ')';
cur_frm.fields_dict['outstanding_amount'].label_area.innerHTML = 'Outstanding Amount (' + base_curr + ')';
cur_frm.fields_dict['tds_amount_on_advance'].label_area.innerHTML = 'TDS Amount On Advance (' + base_curr + ')';
cur_frm.fields_dict['total_advance'].label_area.innerHTML = 'Total Advance (Incl. TDS) (' + base_curr + ')';
cur_frm.fields_dict['total_amount_to_pay'].label_area.innerHTML = 'Total Amount To Pay (' + base_curr + ')';
cur_frm.fields_dict['ded_amount'].label_area.innerHTML = 'TDS Amount (' + base_curr + ')';
} else cur_frm.fields_dict['rounded_total'].label_area.innerHTML = 'Rounded Total (' + base_curr + ')';
}
@ -122,7 +119,7 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')');
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide);
// advance table flds
adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'}
adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount'}
for (d in adv_cols) $('[data-grid-fieldname="Purchase Invoice Advance-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');
}
else {
@ -642,16 +639,13 @@ cur_frm.cscript.calc_doc_values = function(doc, tname, fname, other_fname) {
}
var calculate_outstanding = function(doc) {
var t_tds_tax = 0.0;
doc.total_tds_on_voucher = flt(doc.ded_amount);
// total amount to pay
doc.total_amount_to_pay = flt(flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_tds_on_voucher));
doc.total_amount_to_pay = flt(flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted));
// outstanding amount
if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_tds_on_voucher) - flt(doc.total_advance);
if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_advance);
refresh_many(['total_tds_on_voucher','total_amount_to_pay', 'outstanding_amount']);
refresh_many(['total_amount_to_pay', 'outstanding_amount']);
}

View File

@ -1,5 +1,6 @@
erpnext.updates = [
["4rd December 2012", [
"POS / Mode of Payment: Select default bank / cash account in Mode of Payment and it will be automatically selected in POS Invoice.",
"Email: Add contact name as 'Dear so-and-so' in Email.",
"Report Builder: Remember last column setup for users",
"Report Builder: Autoset column width (remember)",

View File

View File

@ -0,0 +1,42 @@
def execute():
import webnotes
from webnotes.model import delete_doc
from webnotes.model.code import get_obj
from webnotes.model.doc import addchild
# delete doctypes and tables
for dt in ["TDS Payment", "TDS Return Acknowledgement", "Form 16A",
"TDS Rate Chart", "TDS Category", "TDS Control", "TDS Detail",
"TDS Payment Detail", "TDS Rate Detail", "TDS Category Account",
"Form 16A Ack Detail", "Form 16A Tax Detail"]:
delete_doc("DocType", dt)
webnotes.conn.commit()
webnotes.conn.sql("drop table if exists `tab%s`" % dt)
webnotes.conn.begin()
delete_doc("Search Criteria", "tds_return")
# Add tds entry in tax table for purchase invoice
pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice`
where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
for pi in pi_list:
piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
ch = addchild(piobj.doc, 'taxes_and_charges', 'Purchase Taxes and Charges')
ch.charge_type = "Actual"
ch.account_head = piobj.doc.tax_code
ch.description = piobj.doc.tax_code
ch.rate = -1*piobj.doc.ded_amount
ch.tax_amount = -1*piobj.doc.ded_amount
ch.category = "Total"
ch.save(1)
# Add tds entry in entries table for journal voucher
jv_list = webnotes.conn.sql("""select name from `tabJournal Voucher`
where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
for jv in jv_list:
jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
ch = addchild(jvobj.doc, 'entries', 'Journal Voucher Detail')
ch.account = jvobj.doc.tax_code
ch.credit = jvobj.doc.ded_amount
ch.save(1)

View File

@ -705,4 +705,8 @@ patch_list = [
'patch_module': 'patches.november_2012',
'patch_file': 'gle_floating_point_issue',
},
{
'patch_module': 'patches.december_2012',
'patch_file': 'deprecate_tds',
},
]

View File

@ -82,4 +82,25 @@ erpnext.utils.supplier_query = function() {
case when name like \"%s%%\" then 0 else 1 end, \
case when supplier_name like \"%s%%\" then 0 else 1 end, \
name, supplier_name limit 50";
};
};
wn.provide("erpnext.queries");
erpnext.queries.account = function(opts) {
if(!opts)
opts = {};
if(!opts.group_or_ledger)
opts.group_or_ledger = "Ledger";
conditions = [];
$.each(opts, function(key, val) {
conditions.push("tabAccount.`" + key + "`='"+esc_quotes(val)+"'");
});
return 'SELECT tabAccount.name, tabAccount.parent_account, tabAccount.debit_or_credit \
FROM tabAccount \
WHERE tabAccount.docstatus!=2 \
AND tabAccount.%(key)s LIKE "%s" ' + (conditions
? (" AND " + conditions.join(" AND "))
: "")
}

View File

@ -96,6 +96,7 @@ cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
cur_frm.cscript.customer = function(doc,dt,dn) {
if(doc.customer) {
cur_frm.call({
doc: cur_frm.doc,
method: "get_default_customer_address",
args: { customer: doc.customer },
callback: function(r) {