Exemple #1
0
def set_total_expense_zero(posting_date, budget_against_field=None, budget_against_CC=None):
	if budget_against_field == "project":
		budget_against = "_Test Project"
	else:
		budget_against = budget_against_CC or "_Test Cost Center - _TC"

	fiscal_year = get_fiscal_year(nowdate())[0]

	args = frappe._dict({
		"account": "_Test Account Cost for Goods Sold - _TC",
		"cost_center": "_Test Cost Center - _TC",
		"monthly_end_date": posting_date,
		"company": "_Test Company",
		"fiscal_year": fiscal_year,
		"budget_against_field": budget_against_field,
	})

	if not args.get(budget_against_field):
		args[budget_against_field] = budget_against

	existing_expense = get_actual_expense(args)

	if existing_expense:
		if budget_against_field == "cost_center":
			make_journal_entry("_Test Account Cost for Goods Sold - _TC",
			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", posting_date=nowdate(), submit=True)
		elif budget_against_field == "project":
			make_journal_entry("_Test Account Cost for Goods Sold - _TC",
			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True, project="_Test Project", posting_date=nowdate())
Exemple #2
0
def set_total_expense_zero(posting_date,
                           budget_against_field=None,
                           budget_against_CC=None):
    if budget_against_field == "Project":
        budget_against = "_Test Project"
    else:
        budget_against = budget_against_CC or "_Test Cost Center - _TC"
    existing_expense = get_actual_expense(
        frappe._dict({
            "account": "_Test Account Cost for Goods Sold - _TC",
            "cost_center": "_Test Cost Center - _TC",
            "monthly_end_date": posting_date,
            "company": "_Test Company",
            "fiscal_year": "_Test Fiscal Year 2013",
            "budget_against_field": budget_against_field,
            "budget_against": budget_against
        }))

    if existing_expense:
        if budget_against_field == "Cost Center":
            make_journal_entry("_Test Account Cost for Goods Sold - _TC",
                               "_Test Bank - _TC",
                               -existing_expense,
                               "_Test Cost Center - _TC",
                               posting_date="2013-02-28",
                               submit=True)
        elif budget_against_field == "Project":
            make_journal_entry("_Test Account Cost for Goods Sold - _TC",
                               "_Test Bank - _TC",
                               -existing_expense,
                               "_Test Cost Center - _TC",
                               submit=True,
                               project="_Test Project",
                               posting_date="2013-02-28")
Exemple #3
0
def set_total_expense_zero(posting_date, cost_center=None):
	existing_expense = get_actual_expense({
		"account": "_Test Account Cost for Goods Sold - _TC",
		"cost_center": cost_center or "_Test Cost Center - _TC",
		"monthly_end_date": posting_date,
		"company": "_Test Company",
		"fiscal_year": "_Test Fiscal Year 2013"
	}, cost_center or "_Test Cost Center - _TC")
	
	make_journal_entry("_Test Account Cost for Goods Sold - _TC",
		"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
Exemple #4
0
def set_total_expense_zero(posting_date, cost_center=None):
    existing_expense = get_actual_expense(
        {
            "account": "_Test Account Cost for Goods Sold - _TC",
            "cost_center": cost_center or "_Test Cost Center - _TC",
            "monthly_end_date": posting_date,
            "company": "_Test Company",
            "fiscal_year": "_Test Fiscal Year 2013"
        }, cost_center or "_Test Cost Center - _TC")

    make_journal_entry("_Test Account Cost for Goods Sold - _TC",
                       "_Test Bank - _TC",
                       -existing_expense,
                       "_Test Cost Center - _TC",
                       submit=True)
Exemple #5
0
def set_total_expense_zero(posting_date, budget_against_field=None, budget_against_CC=None):
	if budget_against_field == "Project":
		budget_against = "_Test Project"
	else:
		budget_against = budget_against_CC or "_Test Cost Center - _TC"
	existing_expense = get_actual_expense(frappe._dict({
		"account": "_Test Account Cost for Goods Sold - _TC",
		"cost_center": "_Test Cost Center - _TC",
		"monthly_end_date": posting_date,
		"company": "_Test Company",
		"fiscal_year": "_Test Fiscal Year 2013",
		"budget_against_field": budget_against_field,
		"budget_against": budget_against
	}))
	
	if existing_expense:
		if budget_against_field == "Cost Center":
			make_journal_entry("_Test Account Cost for Goods Sold - _TC",
			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
		elif budget_against_field == "Project":
			make_journal_entry("_Test Account Cost for Goods Sold - _TC",
			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True, project="_Test Project")