コード例 #1
0
ファイル: general_ledger.py プロジェクト: aymannabil86/pharma
def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
		adv_adj=False, update_outstanding="Yes"):

	from erpnext.accounts.doctype.gl_entry.gl_entry import validate_balance_type, \
		check_freezing_date, update_outstanding_amt, validate_frozen_account

	if not gl_entries:
		gl_entries = frappe.db.sql("""
			select account, posting_date, party_type, party, cost_center, fiscal_year,voucher_type,
			voucher_no, against_voucher_type, against_voucher, cost_center, company
			from `tabGL Entry`
			where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no), as_dict=True)

	if gl_entries:
		check_freezing_date(gl_entries[0]["posting_date"], adv_adj)

	frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""",
		(voucher_type or gl_entries[0]["voucher_type"], voucher_no or gl_entries[0]["voucher_no"]))

	for entry in gl_entries:
		validate_frozen_account(entry["account"], adv_adj)
		validate_balance_type(entry["account"], adv_adj)
		if not adv_adj:
			validate_expense_against_budget(entry)
		
		if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj:
			update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
				entry.get("against_voucher"), on_cancel=True)
コード例 #2
0
def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
		adv_adj=False, update_outstanding="Yes"):

	from erpnext.accounts.doctype.gl_entry.gl_entry import validate_balance_type, \
		check_freezing_date, update_outstanding_amt, validate_frozen_account

	if not gl_entries:
		gl_entries = frappe.db.sql("""
			select account, posting_date, party_type, party, cost_center, fiscal_year,voucher_type,
			voucher_no, against_voucher_type, against_voucher, cost_center, company
			from `tabGL Entry`
			where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no), as_dict=True)

	if gl_entries:
		check_freezing_date(gl_entries[0]["posting_date"], adv_adj)

	frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""",
		(voucher_type or gl_entries[0]["voucher_type"], voucher_no or gl_entries[0]["voucher_no"]))

	for entry in gl_entries:
		validate_frozen_account(entry["account"], adv_adj)
		validate_balance_type(entry["account"], adv_adj)
		validate_expense_against_budget(entry)
		
		if entry.get("against_voucher") and update_outstanding == 'Yes':
			update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
				entry.get("against_voucher"), on_cancel=True)
コード例 #3
0
def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
    if not from_repost:
        validate_account_for_perpetual_inventory(gl_map)

    round_off_debit_credit(gl_map)

    vouchers_for_balance_update = set()
    for entry in gl_map:
        make_entry(entry, adv_adj, from_repost)

        # check against budget
        if not from_repost:
            validate_expense_against_budget(entry)

        if update_outstanding and not from_repost and entry.get(
                "party_type") and entry.get("party"):
            if entry.get("against_voucher_type") and entry.get(
                    "against_voucher"):
                vouchers_for_balance_update.add(
                    (entry.get("against_voucher_type"),
                     entry.get("against_voucher"), entry.get("account"),
                     entry.get("party_type"), entry.get("party")))
            else:
                vouchers_for_balance_update.add(
                    (entry.get("voucher_type"), entry.get("voucher_no"),
                     entry.get("account"), entry.get("party_type"),
                     entry.get("party")))

    from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
    for voucher_type, voucher_no, account, party_type, party in vouchers_for_balance_update:
        update_outstanding_amt(voucher_type, voucher_no, account, party_type,
                               party)
コード例 #4
0
def save_entries(gl_map, adv_adj, update_outstanding):
	validate_account_for_auto_accounting_for_stock(gl_map)
	round_off_debit_credit(gl_map)

	for entry in gl_map:
		make_entry(entry, adv_adj, update_outstanding)
		# check against budget
		validate_expense_against_budget(entry)
コード例 #5
0
def save_entries(gl_map, adv_adj, update_outstanding):
	validate_account_for_auto_accounting_for_stock(gl_map)
	round_off_debit_credit(gl_map)

	for entry in gl_map:
		make_entry(entry, adv_adj, update_outstanding)
		# check against budget
		validate_expense_against_budget(entry)
コード例 #6
0
ファイル: general_ledger.py プロジェクト: drukhil/erpnext
def save_entries(gl_map, adv_adj, update_outstanding):
	validate_account_for_auto_accounting_for_stock(gl_map)
	round_off_debit_credit(gl_map)

	for entry in gl_map:
		make_entry(entry, adv_adj, update_outstanding)
		# check against budget only if not se
		if entry.voucher_type not in ['Stock Entry', 'Period Closing Voucher']:
			validate_expense_against_budget(entry)
コード例 #7
0
def save_entries(gl_map, adv_adj, update_outstanding):
    validate_account_for_auto_accounting_for_stock(gl_map)
    round_off_debit_credit(gl_map)

    for entry in gl_map:
        make_entry(entry, adv_adj, update_outstanding)
        # check against budget only if not se
        if entry.voucher_type not in ['Stock Entry', 'Period Closing Voucher']:
            validate_expense_against_budget(entry)
コード例 #8
0
ファイル: general_ledger.py プロジェクト: samiir12/ERPNext
def make_entry(args, adv_adj, update_outstanding):
	gle = frappe.new_doc("GL Entry")
	gle.update(args)
	gle.flags.ignore_permissions = 1
	gle.insert()
	gle.run_method("on_update_with_args", adv_adj, update_outstanding)
	gle.submit()

	# check against budget
	validate_expense_against_budget(args)
コード例 #9
0
ファイル: general_ledger.py プロジェクト: HauptschuIe/erpnext
def make_entry(args, adv_adj, update_outstanding, from_repost=False):
    gle = frappe.new_doc("GL Entry")
    gle.update(args)
    gle.flags.ignore_permissions = 1
    gle.flags.from_repost = from_repost
    gle.flags.adv_adj = adv_adj
    gle.flags.update_outstanding = update_outstanding or 'Yes'
    gle.submit()

    if not from_repost:
        validate_expense_against_budget(args)
コード例 #10
0
def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
    if not from_repost:
        validate_account_for_perpetual_inventory(gl_map)

    #round_off_debit_credit(gl_map)
    for entry in gl_map:
        make_entry(entry, adv_adj, update_outstanding, from_repost)

        # check against budget
        if not from_repost:
            validate_expense_against_budget(entry)
コード例 #11
0
ファイル: general_ledger.py プロジェクト: vallantis/ejango
def make_entry(args, adv_adj, update_outstanding, from_repost=False):
	gle = frappe.new_doc("GL Entry")
	gle.update(args)
	gle.flags.ignore_permissions = 1
	gle.flags.from_repost = from_repost
	gle.insert()
	gle.run_method("on_update_with_args", adv_adj, update_outstanding, from_repost)
	gle.submit()

	if not from_repost:
		validate_expense_against_budget(args)
コード例 #12
0
def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
	if not from_repost:
		validate_account_for_perpetual_inventory(gl_map)
		
	round_off_debit_credit(gl_map)

	for entry in gl_map:
		make_entry(entry, adv_adj, update_outstanding, from_repost)
		
		# check against budget
		if not from_repost:
			validate_expense_against_budget(entry)
コード例 #13
0
	def validate_budget(self):
		if self.docstatus == 1:
			for data in self.get('items'):
				args = data.as_dict()
				args.update({
					'doctype': self.doctype,
					'company': self.company,
					'posting_date': (self.schedule_date
						if self.doctype == 'Material Request' else self.transaction_date)
				})

				validate_expense_against_budget(args)
コード例 #14
0
	def validate_budget(self):
		if self.docstatus == 1:
			for data in self.get('items'):
				args = data.as_dict()
				args.update({
					'doctype': self.doctype,
					'company': self.company,
					'posting_date': (self.schedule_date
						if self.doctype == 'Material Request' else self.transaction_date)
				})

				validate_expense_against_budget(args)
コード例 #15
0
ファイル: general_ledger.py プロジェクト: samiir12/ERPNext
def save_entries(gl_map, adv_adj, update_outstanding):
	validate_cwip_accounts(gl_map)

	round_off_debit_credit(gl_map)

	if gl_map:
		check_freezing_date(gl_map[0]["posting_date"], adv_adj)

	for entry in gl_map:
		make_entry(entry, adv_adj, update_outstanding)

		# check against budget
		validate_expense_against_budget(entry)

	validate_account_for_perpetual_inventory(gl_map)
コード例 #16
0
	def validate_budget(self):
		if self.docstatus == 1:
			for data in self.get("items"):
				args = data.as_dict()
				args.update(
					{
						"doctype": self.doctype,
						"company": self.company,
						"posting_date": (
							self.schedule_date if self.doctype == "Material Request" else self.transaction_date
						),
					}
				)

				validate_expense_against_budget(args)