Merge branch 'develop' into fix-financial-statement-print-format
This commit is contained in:
commit
11b0554ae9
@ -1113,7 +1113,10 @@ class SalesInvoice(SellingController):
|
||||
expiry_date=self.posting_date, include_expired_entry=True)
|
||||
if lp_details and getdate(lp_details.from_date) <= getdate(self.posting_date) and \
|
||||
(not lp_details.to_date or getdate(lp_details.to_date) >= getdate(self.posting_date)):
|
||||
points_earned = cint(eligible_amount/lp_details.collection_factor)
|
||||
|
||||
collection_factor = lp_details.collection_factor if lp_details.collection_factor else 1.0
|
||||
points_earned = cint(eligible_amount/collection_factor)
|
||||
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Loyalty Point Entry",
|
||||
"company": self.company,
|
||||
|
@ -6,7 +6,6 @@ from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.utils import add_to_date
|
||||
from frappe.utils.dashboard import get_config, make_records
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("manufacturing", "doctype", "work_order")
|
||||
|
@ -45,6 +45,10 @@ frappe.ui.form.on('GSTR 3B Report', {
|
||||
frm.set_df_property('year', 'options', options);
|
||||
},
|
||||
|
||||
validate: function(frm) {
|
||||
frm.dirty();
|
||||
},
|
||||
|
||||
setup: function(frm) {
|
||||
frm.set_query('company_address', function(doc) {
|
||||
if(!doc.company) {
|
||||
|
@ -243,20 +243,15 @@ class GSTR3BReport(Document):
|
||||
|
||||
osup_det = self.report_dict["sup_details"]["osup_det"]
|
||||
|
||||
for d in inter_state_supply.get("Unregistered", []):
|
||||
self.report_dict["inter_sup"]["unreg_details"].append(d)
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d["txval"], 2)
|
||||
osup_det["iamt"] = flt(osup_det["iamt"] + d["iamt"], 2)
|
||||
for key, value in iteritems(inter_state_supply):
|
||||
if key[0] == "Unregistered":
|
||||
self.report_dict["inter_sup"]["unreg_details"].append(value)
|
||||
|
||||
for d in inter_state_supply.get("Registered Composition", []):
|
||||
self.report_dict["inter_sup"]["comp_details"].append(d)
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d["txval"], 2)
|
||||
osup_det["iamt"] = flt(osup_det["iamt"] + d["iamt"], 2)
|
||||
if key[0] == "Registered Composition":
|
||||
self.report_dict["inter_sup"]["comp_details"].append(value)
|
||||
|
||||
for d in inter_state_supply.get("UIN Holders", []):
|
||||
self.report_dict["inter_sup"]["uin_details"].append(d)
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d["txval"], 2)
|
||||
osup_det["iamt"] = flt(osup_det["iamt"] + d["iamt"], 2)
|
||||
if key[0] == "UIN Holders":
|
||||
self.report_dict["inter_sup"]["uin_details"].append(value)
|
||||
|
||||
def get_total_taxable_value(self, doctype, reverse_charge):
|
||||
|
||||
@ -301,41 +296,54 @@ class GSTR3BReport(Document):
|
||||
(self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)[0].total
|
||||
|
||||
def get_inter_state_supplies(self, state_number):
|
||||
|
||||
inter_state_supply_taxable_value = frappe.db.sql(""" select sum(s.net_total) as total, s.place_of_supply, s.gst_category
|
||||
from `tabSales Invoice` s where s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
|
||||
and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
|
||||
group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||
|
||||
inter_state_supply_tax = frappe.db.sql(""" select sum(t.tax_amount_after_discount_amount) as tax_amount, s.place_of_supply, s.gst_category
|
||||
from `tabSales Invoice` s, `tabSales Taxes and Charges` t
|
||||
inter_state_supply_tax = frappe.db.sql(""" select t.account_head, t.tax_amount_after_discount_amount as tax_amount,
|
||||
s.name, s.net_total, s.place_of_supply, s.gst_category from `tabSales Invoice` s, `tabSales Taxes and Charges` t
|
||||
where t.parent = s.name and s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
|
||||
and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
|
||||
group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||
""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
|
||||
|
||||
inter_state_supply_tax_mapping={}
|
||||
inter_state_supply_tax_mapping = {}
|
||||
inter_state_supply_details = {}
|
||||
|
||||
for d in inter_state_supply_tax:
|
||||
inter_state_supply_tax_mapping.setdefault(d.place_of_supply, d.tax_amount)
|
||||
inter_state_supply_tax_mapping.setdefault(d.name, {
|
||||
'place_of_supply': d.place_of_supply,
|
||||
'taxable_value': d.net_total,
|
||||
'camt': 0.0,
|
||||
'samt': 0.0,
|
||||
'iamt': 0.0,
|
||||
'csamt': 0.0
|
||||
})
|
||||
|
||||
for d in inter_state_supply_taxable_value:
|
||||
inter_state_supply_details.setdefault(
|
||||
d.gst_category, []
|
||||
)
|
||||
if d.account_head in [d.cgst_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['camt'] += d.tax_amount
|
||||
|
||||
if d.account_head in [d.sgst_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['samt'] += d.tax_amount
|
||||
|
||||
if d.account_head in [d.igst_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['samt'] += d.tax_amount
|
||||
|
||||
if d.account_head in [d.cess_account for d in self.account_heads]:
|
||||
inter_state_supply_tax_mapping[d.name]['csamt'] += d.tax_amount
|
||||
|
||||
for key, value in iteritems(inter_state_supply_tax_mapping):
|
||||
if d.place_of_supply:
|
||||
osup_det = self.report_dict["sup_details"]["osup_det"]
|
||||
osup_det["txval"] = flt(osup_det["txval"] + value['taxable_value'], 2)
|
||||
osup_det["camt"] = flt(osup_det["camt"] + value['camt'], 2)
|
||||
osup_det["samt"] = flt(osup_det["samt"] + value['samt'], 2)
|
||||
osup_det["csamt"] = flt(osup_det["csamt"] + value['csamt'], 2)
|
||||
|
||||
if state_number != d.place_of_supply.split("-")[0]:
|
||||
inter_state_supply_details[d.gst_category].append({
|
||||
inter_state_supply_details.setdefault((d.gst_category, d.place_of_supply), {
|
||||
"txval": 0.0,
|
||||
"pos": d.place_of_supply.split("-")[0],
|
||||
"txval": flt(d.total, 2),
|
||||
"iamt": flt(inter_state_supply_tax_mapping.get(d.place_of_supply), 2)
|
||||
"iamt": 0.0
|
||||
})
|
||||
else:
|
||||
osup_det = self.report_dict["sup_details"]["osup_det"]
|
||||
osup_det["txval"] = flt(osup_det["txval"] + d.total, 2)
|
||||
osup_det["camt"] = flt(osup_det["camt"] + inter_state_supply_tax_mapping.get(d.place_of_supply)/2, 2)
|
||||
osup_det["samt"] = flt(osup_det["samt"] + inter_state_supply_tax_mapping.get(d.place_of_supply)/2, 2)
|
||||
|
||||
inter_state_supply_details[(d.gst_category, d.place_of_supply)]['txval'] += value['taxable_value']
|
||||
inter_state_supply_details[(d.gst_category, d.place_of_supply)]['iamt'] += value['iamt']
|
||||
|
||||
return inter_state_supply_details
|
||||
|
||||
|
@ -668,6 +668,11 @@ def get_gst_accounts(company, account_wise=False):
|
||||
return gst_accounts
|
||||
|
||||
def update_grand_total_for_rcm(doc, method):
|
||||
country = frappe.get_cached_value('Company', doc.company, 'country')
|
||||
|
||||
if country != 'India':
|
||||
return
|
||||
|
||||
if doc.reverse_charge == 'Y':
|
||||
gst_accounts = get_gst_accounts(doc.company)
|
||||
gst_account_list = gst_accounts.get('cgst_account') + gst_accounts.get('sgst_account') \
|
||||
|
@ -4,10 +4,10 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.utils import cint, flt
|
||||
from erpnext.stock.utils import update_included_uom_in_report
|
||||
from frappe import _
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
include_uom = filters.get("include_uom")
|
||||
columns = get_columns()
|
||||
@ -15,6 +15,7 @@ def execute(filters=None):
|
||||
sl_entries = get_stock_ledger_entries(filters, items)
|
||||
item_details = get_item_details(items, sl_entries, include_uom)
|
||||
opening_row = get_opening_balance(filters, columns)
|
||||
precision = cint(frappe.db.get_single_value("System Settings", "float_precision"))
|
||||
|
||||
data = []
|
||||
conversion_factors = []
|
||||
@ -29,7 +30,7 @@ def execute(filters=None):
|
||||
sle.update(item_detail)
|
||||
|
||||
if filters.get("batch_no"):
|
||||
actual_qty += sle.actual_qty
|
||||
actual_qty += flt(sle.actual_qty, precision)
|
||||
stock_value += sle.stock_value_difference
|
||||
|
||||
if sle.voucher_type == 'Stock Reconciliation':
|
||||
|
Loading…
x
Reference in New Issue
Block a user