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


Python Document.posting_date方法代码示例

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


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

示例1: create_advance_entry

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
def create_advance_entry(advance_amount, customer_name, debit_to, company):
	jv = Document('Journal Voucher')
	jv.voucher_type = 'Cash Voucher'
	jv.user_remark = 'Advance Payment'
	jv.fiscal_year = webnotes.conn.get_value('Global Defaults',None,'current_fiscal_year')
	jv.user_remark = "Advance from patient %s"%customer_name
	jv.remark = "User Remark : Advance from patient %s"%customer_name
	jv.company = company
	jv.posting_date = nowdate()
	jv.docstatus=1
	jv.save()

	chld1 = Document('Journal Voucher Detail')
	chld1.parent = jv.name
	chld1.account = debit_to
	chld1.cost_center = webnotes.conn.get_value('Company',company,'cost_center')
	chld1.credit = advance_amount
	chld1.is_advance = 'Yes'
	chld1.save()

	chld2 = Document('Journal Voucher Detail')
	chld2.parent = jv.name
	chld2.account = webnotes.conn.get_value('Company',company,'default_cash_account')
	chld2.cost_center = webnotes.conn.get_value('Company',company,'cost_center')
	chld2.debit = advance_amount
	chld2.save()

	create_gl_entry(jv.name, jv.user_remark, company)
开发者ID:saurabh6790,项目名称:OFF-RISAPP,代码行数:30,代码来源:utils.py

示例2: make_bank_voucher

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
	def make_bank_voucher(self):
		self.set_flag()
		"""
			get default bank account,default salary acount from company
		"""
		#amt = self.get_total_salary()
		com = webnotes.conn.sql("""select default_bank_account, default_expense_account from `tabCompany` 
			where name = '%s'""" % self.doc.company,as_list=1)		

		if not com[0][0] or not com[0][1]:
			msgprint("You can set Default Bank Account in Company master.")
		if not self.doc.jv:
			jv = Document('Journal Voucher')
			jv.voucher_type = 'Bank Voucher'
			jv.user_remark = 'Referrals Payment'
			jv.fiscal_year = '2013-14'
			jv.total_credit = jv.total_debit = self.doc.total_amount
			jv.company = self.doc.company
			jv.posting_date = nowdate()
			jv.save()
		
			jvd = Document('Journal Voucher Detail')
			jvd.account = com and com[0][0] or ''
			jvd.credit =  self.doc.total_amount
			jvd.parent = jv.name
			jvd.save()

			jvd1 = Document('Journal Voucher Detail')
			jvd1.account = com and com[0][1] or ''
			jvd1.debit = self.doc.total_amount
			jvd1.parent = jv.name
			jvd1.save()
		
			self.doc.jv = jv.name	
			self.doc.save()
开发者ID:saurabh6790,项目名称:alert-med-app,代码行数:37,代码来源:referrals_payment.py

示例3: upload_accounts_transactions

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
    def upload_accounts_transactions(self):
        import csv

        data = csv.reader(self.get_csv_data().splitlines())

        abbr = sql("select concat(' - ',abbr) as abbr from tabCompany where name=%s", self.doc.company)
        updated = 0
        jv_name = ""
        # 		jv = Document('Journal Voucher')
        global line, jv, name, jv_go
        for line in data:
            if len(line) >= 7:  # Minimum no of fields
                if line[3] != jv_name:  # Create JV
                    if jv_name != "":
                        jv_go = get_obj("Journal Voucher", name, with_children=1)
                        jv_go.validate()
                        jv_go.on_submit()

                    jv_name = line[3]
                    jv = Document("Journal Voucher")
                    jv.voucher_type = line[0]
                    jv.naming_series = line[1]
                    jv.voucher_date = formatdate(line[2])
                    jv.posting_date = formatdate(line[2])
                    # 					jv.name = line[3]
                    jv.fiscal_year = self.doc.fiscal_year
                    jv.company = self.doc.company
                    jv.remark = len(line) == 8 and line[3] + " " + line[7] or line[3] + " Uploaded Record"
                    jv.docstatus = 1
                    jv.save(1)
                    name = jv.name

                    jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
                    jc.account = line[4] + abbr[0][0]
                    jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
                    if line[5] != "":
                        jc.debit = line[5]
                    else:
                        jc.credit = line[6]
                    jc.save()

                else:  # Create JV Child
                    jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
                    jc.account = line[4] + abbr[0][0]
                    jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
                    if line[5] != "":
                        jc.debit = line[5]
                    else:
                        jc.credit = line[6]
                    jc.save()
            else:
                msgprint("[Ignored] Incorrect format: %s" % str(line))
        if jv_name != "":
            jv_go = get_obj("Journal Voucher", name, with_children=1)
            jv_go.validate()
            jv_go.on_submit()

        msgprint("<b>%s</b> items updated" % updated)
开发者ID:Vichagserp,项目名称:cimworks,代码行数:60,代码来源:upload_accounts_transactions.py

示例4: allocate_leave

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
 def allocate_leave(self):
   self.validate_values()
   for d in self.get_employees():
     la = Document('Leave Allocation')
     la.employee = cstr(d[0])
     la.employee_name = webnotes.conn.get_value('Employee',cstr(d[0]),'employee_name')
     la.leave_type = self.doc.leave_type
     la.fiscal_year = self.doc.fiscal_year
     la.posting_date = nowdate()
     la.carry_forward = cint(self.doc.carry_forward)
     la.new_leaves_allocated = flt(self.doc.no_of_days)
     la_obj = get_obj(doc=la)
     la_obj.doc.docstatus = 1
     la_obj.validate()
     la_obj.on_update()
     la_obj.doc.save(1)
   msgprint("Leaves Allocated Successfully")
开发者ID:masums,项目名称:erpnext,代码行数:19,代码来源:leave_control_panel.py

示例5: create_gl

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
	def create_gl(self,data):
		for r in data:
			gl=Document("GL Entry")
			gl.account=r['account']
			gl.debit=r['debit']
			gl.credit=r['credit']
			gl.against=r['against']
			gl.against_voucher_type=r['against_voucher_type']
			gl.voucher_type=r['voucher_type']
			gl.against_voucher=r['against_voucher']
			gl.voucher_no=r['voucher_no']
			gl.cost_center=r['cost_center']
			gl.posting_date=nowdate()
			gl.aging_date=nowdate()
			gl.fiscal_year=webnotes.conn.get_value("Global Defaults",None,"current_fiscal_year")
			gl.company='InnoWorth'
			gl.is_opening='No'
			gl.save()
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:20,代码来源:cgi.py

示例6: make_JV1

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
	def make_JV1(self,sum_patient_amt,debit_to,patient_credit_to,company):
		jv=Document('Journal Voucher')
                jv.voucher_type='Bank Voucher'
                jv.posting_date=nowdate()
                jv.user_remark ='Payment Entry against '+self.doc.name
                jv.fiscal_year = '2013-14'
                jv.total_credit = jv.total_debit = sum_patient_amt
                jv.company = company
                jv.save()

                jvd = Document('Journal Voucher Detail')
                jvd.account = debit_to
                jvd.credit =  sum_patient_amt
		jvd.against_invoice=self.doc.name
                jvd.parent = jv.name
                jvd.save()

                jvd1 = Document('Journal Voucher Detail')
                jvd1.account = patient_credit_to
                jvd1.debit = sum_patient_amt
                jvd1.parent = jv.name
                jvd1.save()
开发者ID:saurabh6790,项目名称:OFF-RISAPP,代码行数:24,代码来源:sales_invoice.py

示例7: calculate_variable

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
	def calculate_variable(self):
		sales_persons=webnotes.conn.sql('select distinct sales_person from `tabSales Team`',as_list=1)
		sp_variable_pay={}
		if sales_persons:
			for person in sales_persons:
				sp_variable_pay[person[0]]=0.0
				fiscal_year=webnotes.conn.sql("select name from `tabFiscal Year`",as_list=1)
				if fiscal_year:
					for year in fiscal_year:
						i=1
						for qtr_month in range(i,5):
							month=self.months.get(cint(qtr_month))
							if month:
								i=i+3
								sales_persons_details=webnotes.conn.sql("""select sum(amount)
									from `tabVariable Pay Summary` where sales_person='%s' and fiscal_year='%s' and quater='%s' 
									and status='False'"""%(person[0],year[0],month),as_list=1)
								if sales_persons_details:
									for total_jv in sales_persons_details:
										target_details=self.target_all_details(person[0],year[0],month)
										if target_details:
											for detail in target_details:
												webnotes.conn.sql("update `tabVariable Pay Summary` set status='True' where sales_person='%s' and fiscal_year='%s' and quater='%s'"%(person[0],year[0],month))
												quater_target_amount=flt(detail[0])*flt(detail[1])/flt(100)
												quater_target_variable_pay=flt(detail[2])*flt(detail[1])/flt(100)
												sp_variable_pay[person[0]]+=flt(total_jv[0])*quater_target_variable_pay/quater_target_amount
				if sp_variable_pay[person[0]]:
					m=cint(self.to_date().month)
					spv=Document('Sales Person Variable Pay')
					spv.sales_person=person[0]
					spv.posting_date=nowdate()
					if self.fiscal_year:
						spv.fiscal_year=self.fiscal_year[0][0]
					spv.variable_pay=sp_variable_pay[person[0]]
					spv.month = '0'+cstr(m) if m in range(1,9) else m
					spv.status='False'
					spv.save()
		webnotes.conn.sql("commit")
开发者ID:Tejal011089,项目名称:med2-app,代码行数:40,代码来源:sales_person_variable_pay.py

示例8: make_JV

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
	def make_JV(self,amount,referrer_physician_credit_to,referrer_physician_debit_to,company):
		
		jv=Document('Journal Voucher')
		jv.voucher_type='Bank Voucher'
		jv.posting_date=nowdate()
		jv.user_remark = 'Referrals Payment against bill '+ self.doc.name
		jv.fiscal_year = '2013-14'
		jv.total_credit = jv.total_debit = amount
		jv.company = company
		jv.against_bill = self.doc.name
		jv.save()

		jvd = Document('Journal Voucher Detail')
		jvd.account = referrer_physician_credit_to
		jvd.debit =  amount
		jvd.parent = jv.name
		jvd.save()

		jvd1 = Document('Journal Voucher Detail')
		jvd1.account = referrer_physician_debit_to
		jvd1.credit = amount
		jvd1.parent = jv.name
		jvd1.save()
开发者ID:saurabh6790,项目名称:alert-med-app,代码行数:25,代码来源:sales_invoice.py

示例9: post_jv

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
def post_jv(data):
	jv = Document('Journal Voucher')
	jv.voucher_type = data.get('voucher_type')
	jv.naming_series = data.get('naming_series')
	jv.voucher_date = data.get('cheque_date')
	jv.posting_date = data.get('cheque_date')
	jv.cheque_no = data.get('cheque_number')
	jv.cheque_date = data.get('cheque_date')
	jv.fiscal_year = data.get('fiscal_year') # To be modified to take care
	jv.company = data.get('company')

	jv.save(1)

	jc = addchild(jv,'entries','Journal Voucher Detail',0)
	jc.account = data.get('debit_account')
	jc.debit = data.get('amount')
	jc.save()

	jc = addchild(jv,'entries','Journal Voucher Detail',0)
	jc.account = data.get('credit_account')
	jc.credit = data.get('amount')
	jc.save()

	return jv.name
开发者ID:NorrWing,项目名称:erpnext,代码行数:26,代码来源:__init__.py

示例10: make_ledger

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
 def make_ledger(self):
         from webnotes.model.doc import Document
         for d in getlist(self.doclist, 'entries'):
                 check=webnotes.conn.sql("select status from `tabSerial No` where name='"+(d.serial_no).strip()+"'",as_list=1)
                 if check[0][0]=='Available':
                         sle=Document('Stock Ledger Entry')
                         sle.item_code=d.item_code
                         sle.serial_no=d.serial_no
                         sle.posting_date=nowdate()
                         sle.posting_time=nowtime()
                         sle.actual_qty=-d.qty
                         qty_data=webnotes.conn.sql("select b.actual_qty,foo.warehouse from(select item_code,warehouse from `tabSerial No` where name='"+(d.serial_no).strip()+"') as foo,tabBin as b where b.item_code=foo.item_code and b.warehouse=foo.warehouse",as_list=1,debug=1)
                         after_transfer=cstr(flt(qty_data[0][0])-flt(d.qty))
                         update_bin=webnotes.conn.sql("update `tabBin` set actual_qty='"+after_transfer+"', projected_qty='"+after_transfer+"' where item_code='"+d.item_code+"' and warehouse='"+qty_data[0][1]+"'")
                         sle.qty_after_transaction=after_transfer
                         sle.warehouse=qty_data[0][1]
                         sle.voucher_type='Delivery Note'
                         sle.voucher_no='GRN000056'
                         sle.stock_uom=webnotes.conn.get_value("Item",d.item_code,"stock_uom")
                         sle.company='PowerCap'
                         sle.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
                         update_serial=webnotes.conn.sql("update `tabSerial No` set status='Delivered',warehouse=(select name from tabCustomer where 1=2) where name='"+(d.serial_no).strip()+"'")
                         sle.docstatus=1
                         sle.save()
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:26,代码来源:sales_invoice.py

示例11: post_jv

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
def post_jv(data):
    jv = Document("Journal Voucher")
    jv.voucher_type = data.get("voucher_type")
    jv.naming_series = data.get("naming_series")
    jv.voucher_date = data.get("cheque_date")
    jv.posting_date = data.get("cheque_date")
    jv.cheque_no = data.get("cheque_number")
    jv.cheque_date = data.get("cheque_date")
    jv.fiscal_year = data.get("fiscal_year")  # To be modified to take care
    jv.company = data.get("company")

    jv.save(1)

    jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
    jc.account = data.get("debit_account")
    jc.debit = data.get("amount")
    jc.save()

    jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
    jc.account = data.get("credit_account")
    jc.credit = data.get("amount")
    jc.save()

    return jv.name
开发者ID:smilekk,项目名称:erpnext,代码行数:26,代码来源:__init__.py

示例12: sle

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
        def sle(self):
                make_bin=[]
		qry="select sum(actual_qty) from `tabStock Ledger Entry` where item_code='"+self.doc.item+"' and warehouse='Finished Goods - P'"	          
                #ebnotes.errprint(qry)
	        w3=webnotes.conn.sql(qry)
	        qty_after_transaction=cstr(cint(w3[0][0])+cint(self.doc.quantity))
	        actual_qty=self.doc.quantity
                import time
	        tim=time.strftime("%X")	   
                from webnotes.model.doc import Document     
		d = Document('Stock Ledger Entry')
		d.item_code=self.doc.item
		d.batch_no=self.doc.name
		d.stock_uom='Nos'
		d.warehouse='Finished Goods - P'
		d.actual_qty=actual_qty
		d.posting_date=today()
		d.posting_time=tim
                d.voucher_type='Purchase Receipt'
                d.serial_no=self.doc.serial_no.replace('\n','')
		d.qty_after_transaction=qty_after_transaction
		d.is_cancelled = 'No'
                d.company='PowerCap'
		d.docstatus = 1;
		d.name = 'Batch wise item updation'
		d.owner = webnotes.session['user']
		d.fields['__islocal'] = 1 
		d.save(new=1)
                make_bin.append({
                       "doctype": 'b',
                       "sle_id":d.name,
                       "item_code": self.doc.item,
		       			"warehouse": 'Finished Goods - P',
		       			"actual_qty": actual_qty 
		       			
		       })
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:38,代码来源:packing_items.py

示例13: set_actual_qty

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
	def set_actual_qty(self):
		from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
        	today = nowdate()


		for p in getlist(self.doclist, 'item_details_table'):
			qr=webnotes.conn.sql(""" select is_asset_item from `tabItem` where item_code=%s""",p.item)
			if qr[0][0] =='No':
				#webnotes.errprint("Is not asset item")

				qry=webnotes.conn.sql("""select sum(actual_qty) from `tabStock Ledger Entry` where item_code=%s
					and warehouse=%s""",
					(p.item,p.warehouse))
				#webnotes.errprint(qry)
				qty_after_transaction=cstr(cint(qry[0][0])-cint(p.quantity))
				actual_qty=cstr(0-cint(p.quantity))
				tim=time.strftime("%X")
				#webnotes.errprint(qty_after_transaction)
	
				if cint(qty_after_transaction) < 0:
				
					webnotes.throw("Not enough quantity available at specified Warehouse for item=" +cstr(p.item))
				else:
					#webnotes.errprint("in stock ledger entry")							
					d = Document('Stock Ledger Entry')
					d.item_code=p.item
					#d.batch_no=p.batch_no
					d.actual_qty=actual_qty
					#webnotes.errprint(actual_qty)
					d.qty_after_transaction=qty_after_transaction
					#webnotes.errprint(d.qty_after_transaction)
					#d.stock_uom=p.product_uom
					d.warehouse=p.warehouse
					d.voucher_type='Project Management'
					#webnotes.errprint(d.voucher_type)
					#d.valuation_rate=p.product_rate
					#d.stock_value=p.quantity
					d.posting_date=today
					#webnotes.errprint(d.posting_date)
					#webnotes.errprint(d.posting_date)
					d.posting_time=tim
					#d.save()
					d.docstatus = 1;
					#d.name = 'SLE/00000008'
					d.owner = webnotes.session['user']
					d.fields['__islocal'] = 1
					d.voucher_no = self.doc.name
					d.voucher_detail_no =p.name
					d.save()
					a=webnotes.conn.sql("select actual_qty,projected_qty from`tabBin` where item_code='"+p.item+"'  and warehouse='"+p.warehouse+"'",as_list=1,debug=1)
					#webnotes.errprint(a)
					#webnotes.errprint(a[0][0])
					#webnotes.errprint(a[0][1])
					if a:

						actual_qty=cstr(cint(a[0][0])-cint(p.quantity))
						projected_qty=cstr(cint(a[0][0])-cint(p.quantity))
						q=webnotes.conn.sql("update `tabBin` set actual_qty=%s,Projected_qty=%s where item_code='"+p.item+"' and warehouse='"+p.warehouse+"'",(actual_qty,projected_qty),debug=1)
					else:
						pass	
					#webnotes.errprint("Updated")
					#make_bin.append({
					#	"doctype": 'pm',
					#	"sle_id":d.name,
					#	"item_code": p.item,
					#	"warehouse": p.warehouse,
					#	"actual_qty": cstr(0-cint(p.quantity))
					#	
					#})
			else:
				pass
开发者ID:Tejal011089,项目名称:med2-app,代码行数:73,代码来源:project_management.py

示例14: create_invoice

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
def create_invoice(auth_key,invoice_type,customer,serial_number,dattime,_type='POST'):
	login =[]
	loginObj = {}
	if len(auth_key[1:-1])<=0 or len(dattime[1:-1])<=0 or len(customer[1:-1])<=0 or len(serial_number[1:-1])<=0 :
		loginObj['status']='401'
		loginObj['error']='Incomplete data to generate Sales Invoice , Please provide token no , Datetime,customer and serial no'
		return loginObj
	qr="select name from `tabauth keys` where auth_key="+auth_key
	res=webnotes.conn.sql(qr)
	rgn=webnotes.conn.sql("select region from `tabFranchise` where contact_email='"+res[0][0]+"'")
	zz=serial_number[1:-1].count(' ')
	xx=serial_number[1:-1].replace('[','').split(' ')
	#xxx=xx.replace(' ','\n')
	yy="select item_code,item_name,description from `tabSerial No` where name='"+cstr(xx[0])+"'"
	zzz=webnotes.conn.sql(yy)
	if not zzz:
          loginObj['status']='402'
          loginObj['error']='Invalid serails no, please try againg'
          return loginObj
	pp="select ref_rate from `tabItem Price` where price_list='Standard Selling' and item_code='"+zzz[0][0]+"'"
	ppp=webnotes.conn.sql(pp)
	if res:
		from webnotes.model.doc import Document
		d = Document('Sales Invoice')
		d.customer=customer[1:-1]
		d.customer_name=customer[1:-1]
		d.region=rgn[0][0]
		d.posting_date=dattime[1:-1]
		d.due_date=dattime[1:-1]
		d.selling_price_list='Standard Selling'
		d.currency='INR'
		d.territory='India'
		if ppp:
			d.net_total_export=ppp[0][0]*zz
			d.grand_total_export=ppp[0][0]*zz
			d.rounded_total_export=ppp[0][0]*zz
			d.outstanding_amount=ppp[0][0]*zz
		d.plc_conversion_rate=1
		from webnotes.utils import nowdate
  		from accounts.utils import get_fiscal_year
   		today = nowdate()
		d.fiscal_year=get_fiscal_year(today)[0]
		d.debit_to=customer[1:-1]+" - P"
		d.is_pos=1
		d.cash_bank_account='Cash - P'
                d.save()
		webnotes.conn.commit()
		e=Document('Sales Invoice Item')
		e.item_code=zzz[0][0]
		e.item_name=zzz[0][1]
		e.description=zzz[0][2]
		e.qty=zz
		e.stock_uom='Nos'
		if ppp:
			e.ref_rate=ppp[0][0]
			e.export_rate=ppp[0][0]
		e.export_amount='0'
		e.income_account='Sales - P'
		e.cost_center='Main - P'
		e.serial_no_=serial_number[1:-1].replace('[','').replace(']','')
		e.parent=d.name
		e.parenttype='Sales Invoice'
		e.parentfield='entries'
		e.save()
		webnotes.conn.commit()
		key={}
		key['invoice_id_id']=d.name
		login.append(key)
		loginObj['status']='200'
		loginObj['invoice']=login
		return loginObj
	else:
		loginObj['status']='401'
		loginObj['error']='invalid token please contact administrator'
		return loginObj
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:77,代码来源:__init__.py

示例15: create_in

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import posting_date [as 别名]
def create_in(data,_type='POST'):
	from webnotes.model.doc import Document
	from webnotes.utils import nowdate,add_months
        data1=json.loads(data)	
        auth_key=data1['token']
        invoice_type=data1['invoice_type']
        customer=data1['customer']
        dattime=data1['datetime']
        item_details=data1['item_details']
        login =[]
        loginObj = {}
	amt=0
        qt=0
        srl=''
        cc=''
        zz=''
	#return data
        if len(auth_key[1:-1]) <=0 or len(dattime[1:-1]) <=0 or len(customer[1:-1])<=0 :
                loginObj['status']='401'
                loginObj['error']='Incomplete data to generate Sales Invoice , Please provide token no , Datetime,customer and serial no'
                return loginObj
 	
        for ff in item_details:
                   a=ff['barcode']
                   c="select item_code,warehouse from `tabSerial No` where name='"+a[:-1]+"'"
                   cc=webnotes.conn.sql(c)
		   #webnotes.errprint(c)
		   #webnotes.errprint(cc)
                   amt=cint(amt)+cint(ff['rate'])
                   qt+=1
                   srl+=a[:-2].replace(',','\n')
		   #return cc
                   if cc :
			qr="select name from `tabauth keys` where auth_key='"+auth_key+"'"
			#return qr
			res=webnotes.conn.sql(qr)
			if res :
		           rr="select region from `tabFranchise` where contact_email='"+res[0][0]+"'"
                           r1=webnotes.conn.sql(rr)
			   if r1[0][0]==cc[0][1] :
				#webnotes.errprint("same")
				pass
			   else:
				#webnotes.errprint("different warehouse")
				pass
				
                        zz+="'"+a[:-1].replace(',','')+"',"
                   else:
                   	if invoice_type=='CUSTOMER':
				l = Document('Customer Details',customer)
		                l.customer_name=customer
		                l.save()
		                webnotes.conn.commit()
				for ll in item_details:
				   m = Document('Customer Data')
				   m.serial_no=a[:-1]
		                   m.parent=l.name
		                   m.parenttype='Customer Details'
		                   m.parentfield='customer_data'
			           m.save(new=1)
				   webnotes.conn.commit()			
			qrt="select name from `tabauth keys` where auth_key='"+auth_key+"'"
		        res=webnotes.conn.sql(qrt)
        		net=0
		        if res:
                		a="select name from tabCustomer where name='"+customer+"'"
		                b=webnotes.conn.sql(a)
		                if b:
		                        a=''
		                else:
                		        d = Document('Customer')
                		        d.customer_name=customer
		                        d.name=customer
                		        d.save(new=1)
                		        webnotes.conn.commit()
               		qr="select name from `tabauth keys` where auth_key='"+auth_key+"'"
               		#webnotes.errprint(qr)
			res=webnotes.conn.sql(qr)
			rgn=''
			if res :
		           rr="select region from `tabFranchise` where contact_email='"+res[0][0]+"'"
		           #webnotes.errprint(qr)
                           r1=webnotes.conn.sql(rr,as_list=1)
                           #webnotes.errprint(r1[0][0])			   
                	d = Document('Sales Invoice')
	                d.customer=customer
	                d.customer_name=customer
        	        d.posting_date=dattime[1:-1]
        	        d.due_date=dattime[1:-1]
        	        d.remarks='Invalid QR code'
        	        d.selling_price_list='Standard Selling'
        	        d.currency='INR'
        	        if r1:
        	        	d.territory=r1[0][0]
        	        	d.region=r1[0][0]
        	        d.net_total_export=0
        	        d.grand_total_export=0
        	        d.rounded_total_export=0
        	        d.plc_conversion_rate=1			
        	        from webnotes.utils import nowdate
#.........这里部分代码省略.........
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:103,代码来源:__init__.py


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