当前位置: 首页>>代码示例>>Python>>正文


Python Document.customer方法代码示例

本文整理汇总了Python中webnotes.model.doc.Document.customer方法的典型用法代码示例。如果您正苦于以下问题:Python Document.customer方法的具体用法?Python Document.customer怎么用?Python Document.customer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webnotes.model.doc.Document的用法示例。


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

示例1: create_lead_address_contact

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def create_lead_address_contact(self):
		if self.doc.lead_name:
			details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, phone, mobile_no, fax, email_id from `tabLead` where name = '%s'" %(self.doc.lead_name), as_dict = 1)
			d = Document('Address') 
			d.address_line1 = details[0]['address_line1'] 
			d.address_line2 = details[0]['address_line2']
			d.city = details[0]['city']
			d.country = details[0]['country']
			d.pincode = details[0]['pincode']
			d.state = details[0]['state']
			d.fax = details[0]['fax']
			d.email_id = details[0]['email_id']
			d.phone = details[0]['phone']
			d.customer = self.doc.name
			d.customer_name = self.doc.customer_name
			d.is_primary_address = 1
			d.address_type = 'Office'
			try:
				d.save(1)
			except NameError, e:
				pass
				
			c = Document('Contact') 
			c.first_name = details[0]['lead_name'] 
			c.email_id = details[0]['email_id']
			c.phone = details[0]['phone']
			c.mobile_no = details[0]['mobile_no']
			c.customer = self.doc.name
			c.customer_name = self.doc.customer_name
			c.is_primary_contact = 1
			try:
				c.save(1)
			except NameError, e:
				pass
开发者ID:antoxin,项目名称:erpnext,代码行数:36,代码来源:customer.py

示例2: get_installation_note

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
def get_installation_note(customer,emp_id,_type='POST'):
	#return "hello "+customer
	qr="select customer_name from `tabCustomer` where customer_name="+customer+" "
	res=webnotes.conn.sql(qr)
	#return res
	from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
	today = nowdate()
	qry="select name from `tabFiscal Year` where is_fiscal_year_closed='No'"
	res1=webnotes.conn.sql(qry)
	#return res1[0][0]
	from webnotes.model.doc import Document
	import time
	if res :
		d= Document('Installation Note')
		d.customer=customer[1:-1]
		d.customer_name=customer[1:-1]
		d.inst_time=time.strftime("%H:%M:%S")
		d.inst_date=today
		d.employee_id=emp_id[1:-1]
		return d.employee_id
		d.fiscal_year=res1[0][0]
		d.company='medsynaptic'
		d.territory='India'
		d.customer_group='Individual'
		#return d.fiscal_year
		d.save()
		webnotes.conn.commit()
	        return d.name	
	else:
		d= Document('Customer')
		d.customer_name=customer[1:-1]
		d.customer_type='Individual'
		d.customer_group='Individual'
		d.territory='India'
		d.save()
		webnotes.conn.commit()
		c= Document('Installation Note')
		c.customer=customer[1:-1]
		c.inst_time=time.strftime("%H:%M:%S")
                c.inst_date=today
		c.fiscal_year=res1[0][0]
		c.employee_id=emp_id[1:-1]
                c.company='Medsynaptic'
                c.territory='India'
		c.customer_group='Individual'
		c.save()
		webnotes.conn.commit()
	        return c.name
开发者ID:Tejal011089,项目名称:Medsyn2_app,代码行数:50,代码来源:__init__.py

示例3: create_contact

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def create_contact(self,name,args):
			c=Document('Contact')
			c.customer_name=args['Customer Name']
			c.first_name=name
			c.customer=name
			c.email_id=args['Email Id']
			c.phone=args['Phone Number']
			c.is_primary_contact=1
			c.save()
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:11,代码来源:cgi.py

示例4: create_contact

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
def create_contact(contact_details):
	from webnotes.model.doc import Document
	contact = Document("Contact")
	contact.first_name = contact_details['first_name'] 
	contact.email_id = contact_details['email_id']
	contact.mobile_no = contact_details['mobile_no']
	if contact_details['doc']=='Customer':
		contact.customer=contact_details['link']
	else:
		contact.referrer_physician=contact_details['link']
	contact.save()
开发者ID:saurabh6790,项目名称:OFF-RISAPP,代码行数:13,代码来源:lead.py

示例5: create_lead_address_contact

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
    def create_lead_address_contact(self):
        if self.doc.lead_name:
            details = sql(
                "select name, lead_name, address_line1, address_line2, city, country, state, pincode, phone, mobile_no, fax, email_id from `tabLead` where name = '%s'"
                % (self.doc.lead_name),
                as_dict=1,
            )
            d = Document("Address")
            d.address_line1 = details[0]["address_line1"]
            d.address_line2 = details[0]["address_line2"]
            d.city = details[0]["city"]
            d.country = details[0]["country"]
            d.pincode = details[0]["pincode"]
            d.state = details[0]["state"]
            d.fax = details[0]["fax"]
            d.email_id = details[0]["email_id"]
            d.phone = details[0]["phone"]
            d.customer = self.doc.name
            d.customer_name = self.doc.customer_name
            d.is_primary_address = 1
            d.address_type = "Office"
            try:
                d.save(1)
            except NameError, e:
                pass

            c = Document("Contact")
            c.first_name = details[0]["lead_name"]
            c.email_id = details[0]["email_id"]
            c.phone = details[0]["phone"]
            c.mobile_no = details[0]["mobile_no"]
            c.customer = self.doc.name
            c.customer_name = self.doc.customer_name
            c.is_primary_contact = 1
            try:
                c.save(1)
            except NameError, e:
                pass
开发者ID:nijil,项目名称:erpnext,代码行数:40,代码来源:customer.py

示例6: create_address

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def create_address(self,name,args):
			c=Document('Address')
                        c.address_line1=args['Address']
                        c.address_type='Shipping'
                        c.customer=name
			c.customer_name=args['Customer Name']
			c.address_title=name
                        c.city=args['City']
                        c.phone=args['Phone Number']
			c.state=args['State']
			c.country=args['Country']
			c.pincode=args['Pincode']
                        c.is_primary_address=1
                        c.save()
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:16,代码来源:cgi.py

示例7: create_p_contact

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def create_p_contact(self,nm,phn_no,email_id,mob_no,fax,cont_addr):
		c1 = Document('Contact')
		c1.first_name = nm
		c1.contact_name = nm
		c1.contact_no = phn_no
		c1.email_id = email_id
		c1.mobile_no = mob_no
		c1.fax = fax
		c1.contact_address = cont_addr
		c1.is_primary_contact = 'Yes'
		c1.is_customer =1
		c1.customer = self.doc.name
		c1.customer_name = self.doc.customer_name
		c1.customer_address = self.doc.address
		c1.customer_group = self.doc.customer_group
		c1.save(1)
开发者ID:antoxin,项目名称:erpnext,代码行数:18,代码来源:customer.py

示例8: set_delivery_serial_no_values

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def set_delivery_serial_no_values(self, obj, serial_no):
		s = Document('Serial No', serial_no)
		s.delivery_document_type =	 obj.doc.doctype
		s.delivery_document_no	 =	 obj.doc.name
		s.delivery_date					=	 obj.doc.posting_date
		s.delivery_time					=	 obj.doc.posting_time
		s.customer						=	 obj.doc.customer
		s.customer_name					=	 obj.doc.customer_name
		s.delivery_address			 	=	 obj.doc.address_display
		s.territory						=	 obj.doc.territory
		s.warranty_expiry_date	 		=	 s.warranty_period and add_days(cstr(obj.doc.posting_date), s.warranty_period) or ''
		s.docstatus						=	 1
		s.status						=	 'Delivered'
		s.modified						=	 nowdate()
		s.modified_by					=	 session['user']
		s.save()
开发者ID:smilekk,项目名称:erpnext,代码行数:18,代码来源:stock_ledger.py

示例9: create_lead_address_contact

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def create_lead_address_contact(self):
		if self.doc.lead_name:
			if not webnotes.conn.get_value("Address", {"lead": self.doc.lead_name, "customer": self.doc.customer}):
				webnotes.conn.sql("""update `tabAddress` set customer=%s, customer_name=%s where lead=%s""", 
					(self.doc.name, self.doc.customer_name, self.doc.lead_name))

			lead = webnotes.conn.get_value("Lead", self.doc.lead_name, ["lead_name", "email_id", "phone", "mobile_no"], as_dict=True)
			c = Document('Contact') 
			c.first_name = lead.lead_name 
			c.email_id = lead.email_id
			c.phone = lead.phone
			c.mobile_no = lead.mobile_no
			c.customer = self.doc.name
			c.customer_name = self.doc.customer_name
			c.is_primary_contact = 1
			try:
				c.save(1)
			except NameError, e:
				pass
开发者ID:abordin,项目名称:erpnext,代码行数:21,代码来源:customer.py

示例10: make_address_from_customer

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
def make_address_from_customer():
	for c in webnotes.conn.sql("select * from tabCustomer", as_dict=1):		
		d = Document('Address') 
		d.address_line1 = c['address_line1'] 
		d.address_line2 = c['address_line2']  
		d.city = c['city']  
		d.country = c['country']  
		d.pincode = c['pincode']
		d.state = c['state']  
		d.fax = c['fax_1']  
		d.email_id = c['email_id']  		
		d.phone = c['phone_1']  
		d.customer = c['name']  
		d.customer_name = c['customer_name']  
		d.is_primary_address = 1
		d.address_type = 'Office'
		try:
			d.save(1)
		except NameError, e:
			pass
开发者ID:ravidey,项目名称:erpnext,代码行数:22,代码来源:customer_address.py

示例11: create_dn

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def create_dn(self):
		'''
		import urllib.request
                import json
		json_dict=[]
		'''
		dn=Document('Delivery Note')
		dn.customer=self.doc.customer
		dn.customer_name=webnotes.conn.get_value("Customer",self.doc.customer,"customer_name")		
		dn.company='InnoWorth'
                dn.conversion_rate=1.00
		dn.posting_date=nowdate()
		dn.posting_time=nowtime()
		dn.customer_address=webnotes.conn.get_value("Address",{"customer":self.doc.customer},"name")
		dn.address_display=get_address_display(dn.customer_address)
		dn.price_list_currency='INR'
                dn.currency='INR'
		dn.docstatus=1
		dn.status="Submitted"
                dn.selling_price_list='Standard Selling'
                dn.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
		dn.save()
		j=0
		html=""
		net_tot=0.00
		for s in getlist(self.doclist,"purchase_receipt_details"):
			j=j+1
			dni=Document("Delivery Note Item")
			dni.item_code=s.item_code
			dni.item_name=s.item_name
			dni.description=s.description
			dni.qty=s.qty
			dni.docstatus=1
			dni.ref_rate=webnotes.conn.get_value("Item Price",{"item_code":dni.item_code,"price_list":"Standard Selling"},"ref_rate")
                        dni.export_rate=webnotes.conn.get_value("Item Price",{"item_code":dni.item_code,"price_list":"Standard Selling"},"ref_rate")
			dni.export_amount=cstr(flt(s.qty)*flt(dni.ref_rate))
			net_tot=cstr(flt(net_tot)+flt(dni.export_amount))
			dni.warehouse=s.warehouse
			dni.stock_uom=s.uom
			dni.serial_no=s.serial_no
			dni.parent=dn.name
			dni.save()
			update_bin=("update tabBin set actual_qty=actual_qty-"+cstr(dni.qty)+" and projected_qty=projected_qty-"+cstr(dni.qty)+" where item_code='"+dni.item_code+"' and warehouse='"+dni.warehouse+"'")
			html+=("<tr><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(j)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(dni.item_code)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(dni.description)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;text-align:right;'><div>"+cstr(dni.qty)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(dni.stock_uom)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align:right'>₹ "+cstr(dni.ref_rate)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align: right'>₹ "+cstr(dni.export_amount)+"</div></td></tr>")
			stl=Document("Stock Ledger Entry")
			stl.item_code=s.item_code
			stl.stock_uom=s.uom
			stl.serial_no=s.serial_no
			stl.warehouse=s.warehouse
			stl.posting_date=nowdate()
			stl.voucher_type="Delivery Note"
			stl.voucher_no=dn.name
			stl.voucher_detail_no=dni.name
			stl.is_cancelled="No"
			stl.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
			stl.actual_qty=cstr(s.qty)
			qty=webnotes.conn.sql("select qty_after_transaction from `tabStock Ledger Entry` where item_code='"+s.item_code+"' and warehouse='"+s.warehouse+"' order by name desc limit 1",as_list=1)
			stl.qty_after_transaction=cstr(flt(qty[0][0])-flt(s.qty))
			stl.save()
			if dni.serial_no:
				for se in dni.serial_no:
					update=webnotes.conn.sql("update `tabSerial No` set status='Delivered', warehouse=(select name from tabCustomer where 1=2) where name='"+se+"'")
					#json_dict.append({"serial_no":se,"supplier_name":self.doc.supplier_name,"item_code":s.item_code})

		dn_=Document("Delivery Note",dn.name)
		dn_.net_total_export=cstr(net_tot)
                dn_.grand_total_export=cstr(net_tot)
                dn_.rounded_total_export=cstr(net_tot)
		a=html_data({"posting_date":datetime.datetime.strptime(nowdate(),'%Y-%m-%d').strftime('%d/%m/%Y'),"due_date":"","customer_name":dn.customer_name,"net_total":dn_.net_total_export,"grand_total":dn_.grand_total_export,"rounded_total":dn_.rounded_total_export,"table_data":html,"date_1":"Posting Date","date_2":"","doctype":"Delivery Note","doctype_no":dn.name,"company":dn.company,"addr_name":"Address","address":dn.address_display,"tax_detail":""})
                attach_file(a,[dn.name,"Selling/Kirana","Delivery Note"])
		'''
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:73,代码来源:purchase_receipt.py

示例12: make_si

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def make_si(self,args):
			parent=sql("select * from `tabSales Order` where name='"+(args['Sales Order No']).strip()+"'",as_dict=1)
			if parent:
				for r in parent:
					si=Document("Sales Invoice")
					si.customer=r['customer']
					si.customer_name=r['customer_name']
					si.posting_date=nowdate()
					si.due_date=nowdate()
					si.charge=r['charge']
               		 	        si.company='InnoWorth'
            	 			si.conversion_rate=1.00
                        		si.customer_group='Individual'
					si.territory=r['territory']
					si.debit_to=webnotes.conn.get_value('Account',{"master_name":r['customer']},'name')
					si.price_list_currency='INR'
                        		si.currency='INR'
                        		si.selling_price_list='Standard Selling'
					si.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
					si.net_total_export=cstr(r['net_total_export'])
                        		si.grand_total_export=cstr(r['grand_total_export'])
					si.other_charges_total_export=cstr(r['other_charges_total_export'])
					si.grand_total=cstr(r['grand_total_export'])
                        		si.rounded_total_export=cstr(r['rounded_total_export'])
					si.save()
					si=Document("Sales Invoice",si.name)
					adv=c_amt=0.00
					flag=False
					check=0
					total=si.grand_total_export
					parent_jv=[]
					advance_payment=sql("select credit,parent,name,against_account from `tabJournal Voucher Detail` where account='"+si.debit_to+"' and is_advance='Yes' and credit<>0 and ifnull(against_invoice,'')='' and docstatus=1 order by name asc",as_list=1)
                			if advance_payment:
                        			for s in advance_payment:
							if s[1] not in parent_jv:
								parent_jv.append(s[1])
							if flt(total) < flt(s[0]) and flag==False:
								adv=cstr(si.grand_total_export)
								update_jv=sql("update `tabJournal Voucher Detail` set against_invoice='"+si.name+"', credit='"+cstr(total)+"' where name='"+s[2]+"'")
								jv = Document("Journal Voucher Detail")
           							jv.account=si.debit_to
           							jv.cost_center= "Main - Frsh"
       								jv.credit= cstr(flt(s[0])-flt(total))
           							jv.is_advance= "Yes"
           							jv.parent=s[1]
								jv.against_account=s[3]
								jv.docstatus=1
								jv.save()
								flag=True
							elif flag==False:
								adv=cstr(flt(adv)+flt(s[0]))
								total=cstr(flt(total)-flt(s[0]))
								update_jv=sql("update `tabJournal Voucher Detail` set against_invoice='"+si.name+"' where name='"+s[2]+"'")
								if flt(total)==0:
									flag=True
								else:
									flag=False
					si.total_advance=cstr(adv)
					si.outstanding_amount=cstr(flt(r['grand_total_export'])-flt(adv))
					si.docstatus=1	
					si.save()
					update=sql("update `tabSales Order` set per_billed='100' where name='"+cstr(r['name'])+"'")
					child=sql("select * from `tabSales Order Item` where parent='"+(args['Sales Order No']).strip()+"'",as_dict=1)
					html=""
					j=0
					credit_amt=0.00
					for s in child:
						j=j+1
						sic=Document("Sales Invoice Item")
						sic.parent=si.name
						sic.item_code=s['item_code']
						sic.item_name=s['item_name']
						sic.item_group=s['item_group']
						sic.description=s['description']
						sic.qty=s['qty']
						sic.stock_uom=s['stock_uom']
						sic.ref_rate=s['ref_rate']
						sic.amount=s['export_amount']
						c_amt=cstr(flt(c_amt)+flt(sic.amount))
						sic.export_rate=s['export_rate']
						sic.export_amount=s['export_amount']
						sic.income_account='Sales - innow'
						sic.cost_center='Main - innow'
						sic.warehouse=s['reserved_warehouse']
						sic.sales_order=r['name']
						sic.so_detail=s['name']
						sic.docstatus=1
						html+=("<tr><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(j)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sic.item_code)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sic.description)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;text-align:right;'><div>"+cstr(sic.qty)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sic.stock_uom)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align:right'>₹ "+cstr(sic.ref_rate)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align: right'>₹ "+cstr(sic.export_amount)+"</div></td></tr>")
						update=sql("update `tabSales Order Item` set billed_amt='"+cstr(s['export_amount'])+"' where name='"+cstr(s['name'])+"'")
						sic.save()
					
					tax_html=self.sales_tax_html((args['Sales Order No']).strip(),si.name,1)
					if parent_jv:
						self.make_adv_payment_gl(parent_jv)
					data=[{"against_voucher":si.name,"account":si.debit_to,"debit":cstr(si.grand_total_export),"credit":"0","against":"Sales - innow","against_voucher_type":"Sales Invoice","voucher_type":"Sales Invoice","voucher_no":si.name,"cost_center":""},{"account":'Sales - innow',"debit":"0","credit":cstr(c_amt),"against":si.debit_to,"against_voucher_type":"","voucher_type":"Sales Invoice","voucher_no":si.name,"cost_center":"Main - innow","against_voucher":""}]

					self.create_gl(data)

					a=html_data({"posting_date":datetime.datetime.strptime(nowdate(),'%Y-%m-%d').strftime('%d/%m/%Y'),"due_date":datetime.datetime.strptime(nowdate(),'%Y-%m-%d').strftime('%d/%m/%Y'),"customer_name":si.customer_name,"net_total":cstr(si.net_total_export),"grand_total":cstr(si.grand_total_export),"rounded_total":cstr(si.rounded_total_export),"table_data":html,"date_1":"Posting Date","date_2":"Due Date","doctype":"Sales Invoice","doctype_no":si.name,"company":si.company,"addr_name":"","address":"","tax_detail":tax_html})

#.........这里部分代码省略.........
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:103,代码来源:cgi.py

示例13: get_customer_issue

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
def get_customer_issue(installationname,sender_no,message,_type='POST'):
		#return installationname[1:-1]
		#sender_no1=sender_no[-11:]
		
		qr="select customer,employee_id from `tabInstallation Note` where name='"+installationname[1:-1]+"' "
        	res=webnotes.conn.sql(qr)
        	#return qr
		x="select customer_name from `tabCustomer` where customer_no='"+sender_no[1:-1]+"' "
		y=webnotes.conn.sql(x)
		#return x
		if y == None:
		
			z="select user_id from `tabEmployee` where cell_number="+sender_no[1:-1]+""	
			m=webnotes.conn.sql(z)
			#return m
		w="select status,user_id from `tabEmployee` where name='%s'"%(res[0][1]);
		t=webnotes.conn.sql(w)
		#return t
		from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
		today = nowdate()
		qry="select name from `tabFiscal Year` where is_fiscal_year_closed='No'"
        	res1=webnotes.conn.sql(qry)
	
		q=" select territory from `tabCustomer` where name='%s'"%(res[0][0]);

		r=webnotes.conn.sql(q)	
	 	w=" select parent from `tabDefaultValue` where  defkey = '%s' and defvalue = '%s'"%('territory',r[0][0])
		a=webnotes.conn.sql(w)
		#return a
		from webnotes.model.doc import Document
		import time
	
    		#if res :
        	d = Document('Support Ticket')
		d.opening_time=time.strftime("%H:%M:%S")
		if y:
			d.raised_by=y[0][0]
		elif z:
			d.raised_by=z[0][0]
		else:
			d.raised_by=sender_no1[-11:]
        	d.subject=installationname[1:-1]
		d.customer_name=res[0][0]
		d.customer=res[0][0]
		d.territory=r[0][0]
		d.status='Open'
		#d.customer_group='Individual'
		d.opening_date=today
        	#d.fiscal_year=res1[0][0]
        	d.company='medsynaptic'
        	d.territory=r[0][0]
		#d.raised_by=res[0][1]
		if t[0][0] =='Active':
			#return t[0][1]
			d.assigned_to=t[0][1]
			d.assigned_to_higher_level=a[0][0]
		else:
			d.assigned_to=a[0][0]
			d.assigned_to_higher_level=a[0][0]
		
		#d.assigned_to_higher_level=a[0][0]
        	#return d.fiscal_year
        	d.save()
        	webnotes.conn.commit()
		#return sender_no[1:-1]
		p=send_sms(message[1:-1],sender_no[1:-1])

        	return d.name   
开发者ID:Tejal011089,项目名称:Medsyn2_app,代码行数:70,代码来源:__init__.py

示例14: service_si

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def service_si(self,s):
		total_amt=0.00
		si=Document("Sales Invoice")
                si.customer=webnotes.conn.get_value("Customer",{"innoworth_id":(s['Customer Id']).strip()},"name")
                si.customer_name=webnotes.conn.get_value("Customer",{"innoworth_id":(s['Customer Id']).strip()},"name")
                si.posting_date=nowdate()
                si.due_date=nowdate()
                si.company='InnoWorth'
                si.conversion_rate=1.00
                si.customer_group='Individual'
                si.territory=s['Territory']
		si.charge=webnotes.conn.get_value("Applicable Territory",{"territory":s['Territory']},"parent")
                si.debit_to=webnotes.conn.get_value('Account',{"master_name":si.customer},'name')
                si.price_list_currency='INR'
                si.currency='INR'
                si.selling_price_list='Standard Selling'
                si.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")               
                si.docstatus=1
                si.save()
		html=""
		j=0
		item_list=[]
                for r in s['Child']:
			j=j+1
			child_data=sql("select name,item_name,item_group,description,stock_uom from `tabItem` where name='"+(r['Item Name']).strip()+"'",as_list=1)
                	sic=Document("Sales Invoice Item")
                        sic.parent=si.name
                        sic.item_code=child_data[0][0]
			sic.item_name=child_data[0][1]
                        sic.item_group=child_data[0][2]
                        sic.description=child_data[0][3]
                        sic.qty=(r['Qty']).strip()
                        sic.stock_uom=child_data[0][4]
                        sic.ref_rate=webnotes.conn.get_value("Item Price",{"item_code":(r['Item Name']).strip(),"price_list":"Standard Selling"},"ref_rate")
			sic.export_rate=webnotes.conn.get_value("Item Price",{"item_code":(r['Item Name']).strip(),"price_list":"Standard Selling"},"ref_rate")
			if child_data[0][1]:
                                sic.export_amount=cstr(flt(sic.ref_rate)*flt((r['Qty']).strip()))
                        else:
                                sic.export_amount=cstr((r['Qty']).strip())
			total_amt=cstr(flt(total_amt)+flt(sic.export_amount))
                        sic.income_account='Sales - innow'
                        sic.cost_center='Main - innow'
                        sic.docstatus=1
			item_list.append({"item_code":sic.item_code,"export_amt":sic.export_amount})
                        sic.save()
			html+=("<tr><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(j)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sic.item_code)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sic.description)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;text-align:right;'><div>"+cstr(sic.qty)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sic.stock_uom)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align:right'>₹ "+cstr(sic.ref_rate)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align: right'>₹ "+cstr(sic.export_amount)+"</div></td></tr>")
		tax_total=0.00
		tax_html=""
                if si.charge:
                        tax_total=self.create_tax(si.charge,si.name,item_list,'Sales Invoice','Sales Taxes and Charges',total_amt)
			tax_html=self.sales_tax_html(si.name,None,0)
		si_=Document('Sales Invoice',si.name)
		si_.net_total_export=cstr(total_amt)	
		si_.other_charges_total_export=cstr(tax_total)
                si_.grand_total_export=cstr(flt(si_.net_total_export)+flt(si_.other_charges_total_export))
		si_.grand_total=cstr(si_.grand_total_export)
                si_.rounded_total_export=cstr(round(flt(si_.grand_total_export)))
		adv=c_amt=0.00
		flag=False
                check=0
                total=si_.grand_total_export
                parent_jv=[]
                advance_payment=sql("select credit,parent,name,against_account from `tabJournal Voucher Detail` where account='"+si.debit_to+"' and is_advance='Yes' and credit<>0 and ifnull(against_invoice,'')='' and docstatus=1 order by name asc",as_list=1)
		if advance_payment:
                	for s in advance_payment:
                        	if s[1] not in parent_jv:
                                	parent_jv.append(s[1])
                                if flt(total) < flt(s[0]) and flag==False:
                                	adv=cstr(si_.grand_total_export)
                                        update_jv=sql("update `tabJournal Voucher Detail` set against_invoice='"+si.name+"', credit='"+cstr(total)+"' where name='"+s[2]+"'")
                                        jv = Document("Journal Voucher Detail")
                                        jv.account=si.debit_to
                                        jv.cost_center= "Main - Frsh"
                                        jv.credit= cstr(flt(s[0])-flt(total))
                                        jv.is_advance= "Yes"
                                        jv.parent=s[1]
                                        jv.against_account=s[3]
                                        jv.docstatus=1
                                        jv.save()
                                        flag=True
                                elif flag==False:
                                	adv=cstr(flt(adv)+flt(s[0]))
                                        total=cstr(flt(total)-flt(s[0]))
                                        update_jv=sql("update `tabJournal Voucher Detail` set against_invoice='"+si.name+"' where name='"+s[2]+"'")
                                        if flt(total)==0:
                                        	flag=True
                                        else:
                                        	flag=False
		si_.total_advance=cstr(adv)
		si_.outstanding_amount=cstr(flt(si_.grand_total_export)-flt(adv))
                si_.docstatus=1
		si_.save()
		if parent_jv:
                	self.make_adv_payment_gl(parent_jv)
                data=[{"against_voucher":si.name,"account":si.debit_to,"debit":cstr(si_.grand_total_export),"credit":"0","against":"Sales - innow","against_voucher_type":"Sales Invoice","voucher_type":"Sales Invoice","voucher_no":si.name,"cost_center":""},{"against_voucher":"","account":'Sales - innow',"debit":"0","credit":cstr(total_amt),"against":si.debit_to,"against_voucher_type":"","voucher_type":"Sales Invoice","voucher_no":si.name,"cost_center":"Main - innow"}]
                self.create_gl(data)
		
		a=html_data({"posting_date":datetime.datetime.strptime(nowdate(),'%Y-%m-%d').strftime('%d/%m/%Y'),"due_date":datetime.datetime.strptime(nowdate(),'%Y-%m-%d').strftime('%d/%m/%Y'),"customer_name":si.customer_name,"net_total":si_.net_total_export,"grand_total":si_.grand_total_export,"rounded_total":si_.rounded_total_export,"table_data":html,"date_1":"Posting Date","date_2":"Due Date","doctype":"Sales Invoice","doctype_no":si.name,"company":si.company,"addr_name":"","address":"","tax_detail":tax_html})
                file_path_=attach_file(a,[si.name,"Account/Kirana","Sales Invoice"])
                return {"Sales Invoice":si.name,"File Copy":file_path_}
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:102,代码来源:cgi.py

示例15: make_so

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import customer [as 别名]
	def make_so(self,args):
		# coding: utf-8
		net_tot=0.00
		so=Document('Sales Order')
                so.transaction_date=nowdate()
                so.price_list_currency='INR'
                so.currency='INR'
                so.selling_price_list='Standard Selling'
                so.customer=webnotes.conn.get_value("Customer",{"innoworth_id":(args['Customer Id']).strip()},"name")
                so.customer_name=webnotes.conn.get_value("Customer",{"innoworth_id":(args['Customer Id']).strip()},"customer_name")
                so.delivery_date=(args['Required Date']).strip()
                so.company='InnoWorth'
                so.conversion_rate=1.00
                so.customer_group='Individual'
                if (args['Territory']).strip():
                	so.territory=(args['Territory']).strip()
			so.charge=webnotes.conn.get_value("Applicable Territory",{"territory":so.territory},"parent")
                so.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
                so.customer_address=webnotes.conn.get_value("Address",{"customer":so.customer},"name")
		so.address_display=get_address_display(so.customer_address)
                so.contact_person=webnotes.conn.get_value("Contact",{"customer":so.customer},"name")
                so.docstatus=1
                so.status='Submitted'
                so.plc_conversion_rate=1
                so.save()
                html=""
		sr=0
		item_list=[]
                for j in args['Child']:
				sr=sr+1
                                soi=Document('Sales Order Item')
                                soi.item_code=(j['Item Name']).strip()
                                soi.qty=(j['Qty']).strip()
				item_details=webnotes.conn.sql("select default_warehouse,item_name,stock_uom,description from tabItem where name='"+(j['Item Name']).strip()+"'",as_list=1)
                                soi.reserved_warehouse=item_details[0][0]
                                soi.item_name=item_details[0][1]                             
                                soi.stock_uom=item_details[0][2]
                                soi.description=item_details[0][3]
                                rate=webnotes.conn.sql("select ref_rate from `tabItem Price` where price_list='Standard Selling' and item_code='"+(j['Item Name']).strip()+"'",as_list=1)
                                if rate:
                                        soi.ref_rate=rate[0][0]
                                        soi.export_rate=rate[0][0]
                                else:
                                        soi.ref_rate=1
                                        soi.export_rate=1
                                soi.export_amount=cstr(flt(soi.ref_rate)*flt((j['Qty']).strip()))
                                item_list.append({"item_code":soi.item_code,"export_amt":soi.export_amount})
                                net_tot=cstr(flt(net_tot)+flt(soi.export_amount))
                                soi.parentfield='sales_order_details'
                                soi.parenttype='Sales Order'
                                soi.docstatus=1
                                soi.parent=so.name
                                soi.save(new=1)
                                html+=("<tr><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(sr)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(soi.item_code)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(soi.description)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;text-align:right;'><div>"+cstr(soi.qty)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'>"+cstr(soi.stock_uom)+"</td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align:right'>₹ "+cstr(soi.ref_rate)+"</div></td><td style='border:1px solid rgb(153, 153, 153);word-wrap: break-word;'><div style='text-align: right'>₹ "+cstr(soi.export_amount)+"</div></td></tr>")
                                data=[]
                                data.append({"item_code":soi.item_code,"so_qty":soi.qty,"proj_qty":(0-flt(soi.qty)),"warehouse":soi.reserved_warehouse,"bin_iqty":"","bin_pqty":"Bin.projected_qty","type":"so"})
                                self.update_bin(data)
		tax_total=0.00
		if so.charge:
			tax_total=self.create_tax(so.charge,so.name,item_list,'Sales Order','Sales Taxes and Charges',net_tot)
                so_=Document("Sales Order",so.name)
                so_.net_total_export=net_tot	
		so_.other_charges_total_export=cstr(tax_total)
                so_.grand_total_export=cstr(flt(so_.net_total_export)+flt(so_.other_charges_total_export))
                so_.rounded_total_export=cstr(round(flt(so_.grand_total_export)))
                so_.save()
                a=html_data({"posting_date":datetime.datetime.strptime(nowdate(),'%Y-%m-%d').strftime('%d/%m/%Y'),"due_date":datetime.datetime.strptime(so.delivery_date,'%Y-%m-%d').strftime('%d/%m/%Y'),"customer_name":so.customer_name,"net_total":net_tot,"grand_total":net_tot,"rounded_total":net_tot,"table_data":html,"date_1":"Sales Order Date","date_2":"Expected Delivery Date","doctype":"Sales Order","doctype_no":so.name,"company":so.company,"addr_name":"Customer Address","address":so.address_display,"tax_detail":""})
                file_path_=attach_file(a,[so.name,"Selling/Kirana","Sales Order"])
                return {"Sales Order":so.name,"File Copy":file_path_}
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:71,代码来源:cgi.py


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