• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.nowdate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.utils.nowdate函数的典型用法代码示例。如果您正苦于以下问题:Python nowdate函数的具体用法?Python nowdate怎么用?Python nowdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了nowdate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_save_journal_voucher

	def test_save_journal_voucher(self):
		expense_ac_balance = get_balance_on(get_name("Test Expense"), nowdate())
		supplier_ac_balance = get_balance_on(get_name("Test Supplier"), nowdate())
		
		dl = webnotes.model.insert(data["journal_voucher"])
		dl.submit()
		dl.load_from_db()
		
		# test submitted jv
		self.assertTrue(webnotes.conn.exists("Journal Voucher", dl.doclist[0].name))
		for d in dl.doclist[1:]:
			self.assertEquals(webnotes.conn.get_value("Journal Voucher Detail",
				d.name, "parent"), dl.doclist[0].name)
		
		# test gl entry
		gle = webnotes.conn.sql("""select account, debit, credit
			from `tabGL Entry` where voucher_no = %s order by account""",
			 dl.doclist[0].name)
		
		self.assertEquals((gle[0][0], flt(gle[0][1]), flt(gle[0][2])), 
			('Test Expense - %s' % abbr, 5000.0, 0.0))
		self.assertEquals((gle[1][0], flt(gle[1][1]), flt(gle[1][2])), 
			('Test Supplier - %s' % abbr, 0.0, 5000.0))
	
		# check balance as on today
		self.assertEqual(get_balance_on(get_name("Test Expense"), nowdate()),
			expense_ac_balance + 5000)
		self.assertEqual(get_balance_on(get_name("Test Supplier"), nowdate()),
			supplier_ac_balance + 5000)
			
		# check previous balance
		self.assertEqual(get_balance_on(get_name("Test Expense"), add_days(nowdate(), -1)), 0)
开发者ID:robertbecht,项目名称:erpnext,代码行数:32,代码来源:test_journal_voucher.py


示例2: create_feed_and_todo

	def create_feed_and_todo(self):
		"""update activty feed and create todo for creation of item, customer, vendor"""
		import home
		home.make_feed('Comment', 'ToDo', '', webnotes.session['user'],
			'<i>"' + 'Setup Complete. Please check your <a href="#!todo">\
			To Do List</a>' + '"</i>', '#6B24B3')

		d = Document('ToDo')
		d.description = 'Create your first Customer'
		d.priority = 'High'
		d.date = nowdate()
		d.reference_type = 'Customer'
		d.save(1)

		d = Document('ToDo')
		d.description = 'Create your first Item'
		d.priority = 'High'
		d.date = nowdate()
		d.reference_type = 'Item'
		d.save(1)

		d = Document('ToDo')
		d.description = 'Create your first Supplier'
		d.priority = 'High'
		d.date = nowdate()
		d.reference_type = 'Supplier'
		d.save(1)
开发者ID:NorrWing,项目名称:erpnext,代码行数:27,代码来源:setup_control.py


示例3: make_stock_ledger_entry

    def make_stock_ledger_entry(self, update_stock):
        from webnotes.model.code import get_obj

        values = [
            {
                "item_code": self.doc.item_code,
                "warehouse": self.doc.warehouse,
                "transaction_date": nowdate(),
                "posting_date": self.doc.purchase_date
                or (self.doc.creation and self.doc.creation.split(" ")[0])
                or nowdate(),
                "posting_time": self.doc.purchase_time or "00:00",
                "voucher_type": "Serial No",
                "voucher_no": self.doc.name,
                "voucher_detail_no": "",
                "actual_qty": 1,
                "stock_uom": webnotes.conn.get_value("Item", self.doc.item_code, "stock_uom"),
                "incoming_rate": self.doc.purchase_rate,
                "company": self.doc.company,
                "fiscal_year": self.doc.fiscal_year,
                "is_cancelled": update_stock and "No" or "Yes",
                "batch_no": "",
                "serial_no": self.doc.name,
            }
        ]
        get_obj("Stock Ledger", "Stock Ledger").update_stock(values)
开发者ID:Vichagserp,项目名称:cimworks,代码行数:26,代码来源:serial_no.py


示例4: manage_recurring_invoices

def manage_recurring_invoices():
	""" 
		Create recurring invoices on specific date by copying the original one
		and notify the concerned people
	"""	
	rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` \
		where ifnull(convert_into_recurring_invoice, 0) = 1 and next_date = %s \
		and next_date <= ifnull(end_date, '2199-12-31') and docstatus=1""", nowdate())
	
	
	exception_list = []
	for d in rv:
		if not webnotes.conn.sql("""select name from `tabSales Invoice` \
			where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
			try:
				prev_rv = get_obj('Sales Invoice', d[0], with_children=1)
				new_rv = create_new_invoice(prev_rv)

				send_notification(new_rv)
				webnotes.conn.commit()
			except Exception, e:
				webnotes.conn.rollback()

				webnotes.conn.begin()
				webnotes.conn.sql("update `tabSales Invoice` set \
					convert_into_recurring_invoice = 0 where name = %s", d[0])
				notify_errors(d[0], prev_rv.doc.owner)
				webnotes.conn.commit()

				exception_list.append(e)
			finally:
开发者ID:Coalas,项目名称:erpnext,代码行数:31,代码来源:gl_control.py


示例5: create_auto_indent

	def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
		"""	Create indent on reaching reorder level	"""

		indent = Document('Purchase Request')
		indent.transaction_date = nowdate()
		indent.naming_series = 'IDT'
		indent.company = get_defaults()['company']
		indent.fiscal_year = get_defaults()['fiscal_year']
		indent.remark = "This is an auto generated Purchase Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
		indent.save(1)
		indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
		indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item',0)
		indent_details_child.item_code = self.doc.item_code
		indent_details_child.uom = self.doc.stock_uom
		indent_details_child.warehouse = self.doc.warehouse
		indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
		indent_details_child.item_name = i['item_name']
		indent_details_child.description = i['description']
		indent_details_child.item_group = i['item_group']
		indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty))
		indent_details_child.brand = i['brand']
		indent_details_child.save()
		indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
		indent_obj.validate()
		set(indent_obj.doc,'docstatus',1)
		indent_obj.on_submit()
		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Purchase Request %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
		if(i['email_notify']):
			send_email_notification(doc_type,doc_name)
开发者ID:NorrWing,项目名称:erpnext,代码行数:29,代码来源:bin.py


示例6: get_balance_on

def get_balance_on(account=None, date=None):
    if not account and webnotes.form_dict.get("account"):
        account = webnotes.form_dict.get("account")
        date = webnotes.form_dict.get("date")

    cond = []
    if date:
        cond.append("posting_date <= '%s'" % date)
    else:
        # get balance of all entries that exist
        date = nowdate()

    try:
        year_start_date = get_fiscal_year(date, verbose=0)[1]
    except FiscalYearError, e:
        from webnotes.utils import getdate

        if getdate(date) > getdate(nowdate()):
            # if fiscal year not found and the date is greater than today
            # get fiscal year for today's date and its corresponding year start date
            year_start_date = get_fiscal_year(nowdate(), verbose=1)[1]
        else:
            # this indicates that it is a date older than any existing fiscal year.
            # hence, assuming balance as 0.0
            return 0.0
开发者ID:nivawebs,项目名称:erpnext,代码行数:25,代码来源:utils.py


示例7: manage_recurring_invoices

def manage_recurring_invoices():
	""" 
		Create recurring invoices on specific date by copying the original one
		and notify the concerned people
	"""
	recurring_invoices = webnotes.conn.sql("""select name, recurring_id
		from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0)=1
		and docstatus=1 and next_date=%s
		and next_date <= ifnull(end_date, '2199-12-31')""", nowdate())
	
	exception_list = []
	for ref_invoice, recurring_id in recurring_invoices:
		if not webnotes.conn.sql("""select name from `tabSales Invoice`
				where posting_date=%s and recurring_id=%s and docstatus=1""",
				(nowdate(), recurring_id)):
			try:
				ref_wrapper = webnotes.model_wrapper('Sales Invoice', ref_invoice)
				new_invoice_wrapper = make_new_invoice(ref_wrapper)
				send_notification(new_invoice_wrapper)
				webnotes.conn.commit()
			except Exception, e:
				webnotes.conn.rollback()

				webnotes.conn.begin()
				webnotes.conn.sql("update `tabSales Invoice` set \
					convert_into_recurring_invoice = 0 where name = %s", ref_invoice)
				notify_errors(ref_invoice, ref_wrapper.doc.owner)
				webnotes.conn.commit()

				exception_list.append(webnotes.getTraceback())
			finally:
开发者ID:masums,项目名称:erpnext,代码行数:31,代码来源:sales_invoice.py


示例8: reorder_indent

	def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify=1):
		indent = Document('Indent')
		indent.transaction_date = nowdate()
		indent.naming_series = 'IDT'
		indent.company = get_defaults()['company']
		indent.fiscal_year = get_defaults()['fiscal_year']
		indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level when %s %s was created"%(doc_type,doc_name)
		indent.save(1)
		indent_obj = get_obj('Indent',indent.name,with_children=1)
		indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
		indent_details_child.item_code = self.doc.item_code
		indent_details_child.uom = self.doc.stock_uom
		indent_details_child.warehouse = self.doc.warehouse
		indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
		indent_details_child.item_name = i['item_name']
		indent_details_child.description = i['description']
		indent_details_child.item_group = i['item_group']
		if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
			indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
		else:
			indent_details_child.qty = i['min_order_qty']
		indent_details_child.brand = i['brand']
		indent_details_child.save()
		indent_obj = get_obj('Indent',indent.name,with_children=1)
		indent_obj.validate()
		set(indent_obj.doc,'docstatus',1)
		indent_obj.on_submit()
		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
		if(email_notify):
			send_email_notification(doc_type,doc_name)
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:30,代码来源:bin.py


示例9: create_material_request

def create_material_request(material_requests):
	"""	Create indent on reaching reorder level	"""
	mr_list = []
	defaults = webnotes.defaults.get_defaults()
	exceptions_list = []
	for request_type in material_requests:
		for company in material_requests[request_type]:
			try:
				items = material_requests[request_type][company]
				if not items:
					continue
					
				mr = [{
					"doctype": "Material Request",
					"company": company,
					"fiscal_year": defaults.fiscal_year,
					"transaction_date": nowdate(),
					"material_request_type": request_type
				}]
			
				for d in items:
					item = webnotes.doc("Item", d.item_code)
					mr.append({
						"doctype": "Material Request Item",
						"parenttype": "Material Request",
						"parentfield": "indent_details",
						"item_code": d.item_code,
						"schedule_date": add_days(nowdate(),cint(item.lead_time_days)),
						"uom":	item.stock_uom,
						"warehouse": d.warehouse,
						"item_name": item.item_name,
						"description": item.description,
						"item_group": item.item_group,
						"qty": d.reorder_qty,
						"brand": item.brand,
					})
			
				mr_bean = webnotes.bean(mr)
				mr_bean.insert()
				mr_bean.submit()
				mr_list.append(mr_bean)

			except:
				if webnotes.local.message_log:
					exceptions_list.append([] + webnotes.local.message_log)
					webnotes.local.message_log = []
				else:
					exceptions_list.append(webnotes.getTraceback())

	if mr_list:
		if getattr(webnotes.local, "reorder_email_notify", None) is None:
			webnotes.local.reorder_email_notify = cint(webnotes.conn.get_value('Stock Settings', None, 
				'reorder_email_notify'))
			
		if(webnotes.local.reorder_email_notify):
			send_email_notification(mr_list)

	if exceptions_list:
		notify_errors(exceptions_list)
开发者ID:Jdfkat,项目名称:erpnext,代码行数:59,代码来源:utils.py


示例10: execute

def execute():
	item_map = {}
	for item in webnotes.conn.sql("""select * from tabItem""", as_dict=1):
		item_map.setdefault(item.name, item)
	
	warehouse_map = get_warehosue_map()
	naming_series = "STE/13/"
	
	for company in webnotes.conn.sql("select name from tabCompany"):
		stock_entry = [{
			"doctype": "Stock Entry",
			"naming_series": naming_series,
			"posting_date": nowdate(),
			"posting_time": nowtime(),
			"purpose": "Material Transfer",
			"company": company[0],
			"remarks": "Material Transfer to activate perpetual inventory",
			"fiscal_year": get_fiscal_year(nowdate())[0]
		}]
		expense_account = "Cost of Goods Sold - NISL"
		cost_center = "Default CC Ledger - NISL"
		
		for bin in webnotes.conn.sql("""select * from tabBin bin where ifnull(item_code, '')!='' 
				and ifnull(warehouse, '') in (%s) and ifnull(actual_qty, 0) != 0
				and (select company from tabWarehouse where name=bin.warehouse)=%s""" %
				(', '.join(['%s']*len(warehouse_map)), '%s'), 
				(warehouse_map.keys() + [company[0]]), as_dict=1):
			item_details = item_map[bin.item_code]
			new_warehouse = warehouse_map[bin.warehouse].get("fixed_asset_warehouse") \
				if cstr(item_details.is_asset_item) == "Yes" \
				else warehouse_map[bin.warehouse].get("current_asset_warehouse")
				
			if item_details.has_serial_no == "Yes":
				serial_no = "\n".join([d[0] for d in webnotes.conn.sql("""select name 
					from `tabSerial No` where item_code = %s and warehouse = %s 
					and status in ('Available', 'Sales Returned')""", 
					(bin.item_code, bin.warehouse))])
			else:
				serial_no = None
			
			stock_entry.append({
				"doctype": "Stock Entry Detail",
				"parentfield": "mtn_details",
				"s_warehouse": bin.warehouse,
				"t_warehouse": new_warehouse,
				"item_code": bin.item_code,
				"description": item_details.description,
				"qty": bin.actual_qty,
				"transfer_qty": bin.actual_qty,
				"uom": item_details.stock_uom,
				"stock_uom": item_details.stock_uom,
				"conversion_factor": 1,
				"expense_account": expense_account,
				"cost_center": cost_center,
				"serial_no": serial_no
			})
		
		webnotes.bean(stock_entry).insert()
开发者ID:CarlosAnt,项目名称:erpnext,代码行数:58,代码来源:perpetual_inventory_stock_transfer_utility.py


示例11: execute

def execute(filters=None):
	if not filters: filters = {}
	supplier_naming_by = webnotes.conn.get_value("Buying Settings", None, "supp_master_name")
	columns = get_columns(supplier_naming_by)
	entries = get_gl_entries(filters)
	account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select acc.name, 
		supp.supplier_name, supp.name as supplier 
		from `tabAccount` acc, `tabSupplier` supp 
		where acc.master_type="Supplier" and supp.name=acc.master_name""", as_dict=1)))

	entries_after_report_date = [[gle.voucher_type, gle.voucher_no] 
		for gle in get_gl_entries(filters, before_report_date=False)]

	account_supplier_type_map = get_account_supplier_type_map()
	voucher_detail_map = get_voucher_details()

	# Age of the invoice on this date
	age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \
		and nowdate() or filters.get("report_date")

	data = []
	for gle in entries:
		if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
				or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
			voucher_details = voucher_detail_map.get(gle.voucher_type, {}).get(gle.voucher_no, {})
			
			invoiced_amount = gle.credit > 0 and gle.credit or 0
			outstanding_amount = get_outstanding_amount(gle, 
				filters.get("report_date") or nowdate())

			if abs(flt(outstanding_amount)) > 0.01:
				paid_amount = invoiced_amount - outstanding_amount
				row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, 
					voucher_details.get("due_date", ""), voucher_details.get("bill_no", ""), 
					voucher_details.get("bill_date", ""), invoiced_amount, 
					paid_amount, outstanding_amount]
				
				# Ageing
				if filters.get("ageing_based_on") == "Due Date":
					ageing_based_on_date = voucher_details.get("due_date", "")
				else:
					ageing_based_on_date = gle.posting_date
					
				row += get_ageing_data(age_on, ageing_based_on_date, outstanding_amount) + \
					[account_map.get(gle.account).get("supplier") or ""]

				if supplier_naming_by == "Naming Series":
					row += [account_map.get(gle.account).get("supplier_name") or ""]

				row += [account_supplier_type_map.get(gle.account), gle.remarks]
				data.append(row)

	for i in range(0, len(data)):
		data[i].insert(4, """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
			% ("/".join(["#Form", data[i][2], data[i][3]]),))

	return columns, data
开发者ID:RanjithP,项目名称:erpnext,代码行数:57,代码来源:accounts_payable.py


示例12: execute

def execute(filters=None):
	if not filters: filters = {}
	columns = get_columns()
	
	entries = get_gl_entries(filters)
	
	entries_after_report_date = [[gle.voucher_type, gle.voucher_no] 
		for gle in get_gl_entries(filters, before_report_date=False)]
	
	account_supplier_type_map = get_account_supplier_type_map()
	pi_map = get_pi_map()

	# Age of the invoice on this date
	age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \
		and nowdate() or filters.get("report_date")

	data = []
	total_invoiced_amount = total_paid = total_outstanding = 0
	for gle in entries:
		if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
				or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
			
			if gle.voucher_type == "Purchase Invoice":
				pi_info = pi_map.get(gle.voucher_no)
				due_date = pi_info.get("due_date")
				bill_no = pi_info.get("bill_no")
				bill_date = pi_info.get("bill_date")
			else:
				due_date = bill_no = bill_date = ""
		
			invoiced_amount = gle.credit > 0 and gle.credit or 0		
			paid_amount = get_paid_amount(gle, filters.get("report_date") or nowdate(), 
				entries_after_report_date)
			outstanding_amount = invoiced_amount - paid_amount
		
			if abs(flt(outstanding_amount)) > 0.01:
				row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, 
					gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no, 
					bill_date, invoiced_amount, paid_amount, outstanding_amount]
				
				# Ageing
				if filters.get("ageing_based_on") == "Due Date":
					ageing_based_on_date = due_date
				else:
					ageing_based_on_date = gle.posting_date
				row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
				
				# Add to total
				total_invoiced_amount += flt(invoiced_amount)
				total_paid += flt(paid_amount)
				total_outstanding += flt(outstanding_amount)
				data.append(row)
	if data:
		data.append(["", "", "", "", "", "", "", "Total", "", total_invoiced_amount, total_paid, 
			total_outstanding, "", "", "", ""])
				
	return columns, data
开发者ID:InBeta,项目名称:erpnext,代码行数:57,代码来源:accounts_payable.py


示例13: update_acc_bal

 def update_acc_bal(self,args):
   args = eval(args)
   self.doc.credit_balance = cint(self.doc.credit_balance) + cint(args.get('net_cr'))
   self.doc.total_users = cint(self.doc.total_users) + cint(args.get('total_users'))
   if cint(self.doc.is_trial_account) == 1:
     if not self.doc.account_start_date:
       self.doc.account_start_date = nowdate()
     self.doc.is_trial_account = 0
     self.doc.billing_cycle_date = nowdate()
     self.doc.last_deduction_date = nowdate()
   self.doc.save()
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:11,代码来源:wn_erp_client_control.py


示例14: check_late_submission

 def check_late_submission(self):
   current_month = nowdate().split('-')[1]
   current_day = nowdate().split('-')[2]
   to_date_month = self.doc.end_date.split('-')[1]
   if flt(current_day) > 5 and flt(current_month) != flt(to_date_month):
     self.doc.status = 'Late'
     msgprint("Late Submission")
     if not self.doc.reason_for_late_submission:
       msgprint("Please Enter the reason for LATE Submission")
       raise Exception
   else:
     self.doc.status = 'On Time'
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:12,代码来源:local_travel_expense_statement.py


示例15: declare_completed

 def declare_completed(self):
   if self.doc.status == 'Open':
     self.validate_for_pending_review()
     self.doc.review_date = nowdate()
   else:
     self.validate_with_timesheet_dates()
   self.validate_for_closed()
   self.doc.closing_date = nowdate()
   set(self.doc, 'status', 'Closed')
   set(self.doc, 'docstatus', 1)
   self.doc.save()
   return cstr('true')
开发者ID:ravidey,项目名称:erpnext,代码行数:12,代码来源:ticket.py


示例16: get_fy_details

 def get_fy_details(self, fy_start):
     st = {"1st Jan": "01-01", "1st Apr": "04-01", "1st Jul": "07-01", "1st Oct": "10-01"}
     curr_year = getdate(nowdate()).year
     if cint(getdate(nowdate()).month) < cint((st[fy_start].split("-"))[0]):
         curr_year = getdate(nowdate()).year - 1
     stdt = cstr(curr_year) + "-" + cstr(st[fy_start])
     # eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
     if fy_start == "1st Jan":
         fy = cstr(getdate(nowdate()).year)
     else:
         fy = cstr(curr_year) + "-" + cstr(curr_year + 1)
     return fy, stdt
开发者ID:ravidey,项目名称:erpnext,代码行数:12,代码来源:setup_control.py


示例17: get_fy_details

	def get_fy_details(self, fy_start):
		st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
		curr_year = getdate(nowdate()).year
		if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
			curr_year = getdate(nowdate()).year - 1
		stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
		#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
		if(fy_start == '1st Jan'):
			fy = cstr(getdate(nowdate()).year)
		else:
			fy = cstr(curr_year) + '-' + cstr(curr_year+1)
		return fy,stdt
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:12,代码来源:setup_control.py


示例18: calc_days

 def calc_days(self):
   if self.doc.billing_cycle_date:
     next_bill_month = cint(nowdate().split('-')[1])
     if cint(nowdate().split('-')[2]) > cint(self.doc.billing_cycle_date.split('-')[2]):
       next_bill_month = cint(nowdate().split('-')[1]) + 1
     next_bill_year = nowdate().split('-')[0]
     if next_bill_month > 12:
       next_bill_month = next_bill_month % 12
       next_bill_year += 1
     self.next_bill_sdate = cstr(next_bill_year)+'-'+cstr(next_bill_month)+'-'+(self.calc_next_day(next_bill_year,next_bill_month))
     #msgprint("next_bill_month :::" + self.next_bill_sdate)
     return date_diff(self.next_bill_sdate, nowdate())
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:12,代码来源:wn_erp_client_control.py


示例19: update_serial_no_warranty_amc_status

	def update_serial_no_warranty_amc_status(self, serial_no_list = []):
		if serial_no_list:
			sr_list = serial_no_list
		else:
			sr_list = [s[0] for s in sql("select name from `tabSerial No` where docstatus = 1")]
		
		for s in sr_list:
			sr = Document('Serial No', s)
			if sr.amc_expiry_date:
				sr.warranty_amc_status = (sr.amc_expiry_date < nowdate()) and 'Out of AMC' or 'Under AMC'
			elif sr.warranty_expiry_date:
				sr.warranty_amc_status = (sr.warranty_expiry_date < nowdate()) and 'Out of Warranty' or 'Under Warranty'
			sr.save()
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:13,代码来源:transaction_base.py


示例20: execute

def execute(filters=None):
	if not filters: filters = {}
	columns = get_columns()
	entries = get_gl_entries(filters)
	
	entries_after_report_date = [[gle.voucher_type, gle.voucher_no] 
		for gle in get_gl_entries(filters, upto_report_date=False)]
	
	account_territory_map = get_account_territory_map()
	si_due_date_map = get_si_due_date_map()
		
	# Age of the invoice on this date
	age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \
		and nowdate() or filters.get("report_date")

	data = []
	total_invoiced_amount = total_payment = total_outstanding = 0
	for gle in entries:
		if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
				or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
			
			due_date = (gle.voucher_type == "Sales Invoice") \
				and si_due_date_map.get(gle.voucher_no) or ""
		
			invoiced_amount = gle.debit > 0 and gle.debit or 0		
			payment_amount = get_payment_amount(gle, filters.get("report_date") or nowdate(), 
				entries_after_report_date)
			outstanding_amount = invoiced_amount - payment_amount
		
			if abs(flt(outstanding_amount)) > 0.01:
				row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, 
					gle.remarks, due_date, account_territory_map.get(gle.account), 
					invoiced_amount, payment_amount, outstanding_amount]
				# Ageing
				if filters.get("ageing_based_on") == "Due Date":
					ageing_based_on_date = due_date
				else:
					ageing_based_on_date = gle.posting_date
				row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
				
				# Add to total
				total_invoiced_amount += flt(invoiced_amount)
				total_payment += flt(payment_amount)
				total_outstanding += flt(outstanding_amount)
				
				data.append(row)
	if data:
		data.append(["", "", "", "", "", "", "Total", total_invoiced_amount, total_payment, 
			total_outstanding, "", "", "", ""])
				
	return columns, data
开发者ID:InBeta,项目名称:erpnext,代码行数:51,代码来源:accounts_receivable.py



注:本文中的webnotes.utils.nowdate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.random_string函数代码示例发布时间:2022-05-26
下一篇:
Python utils.now_datetime函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap