def accountinput_edit_submit(request): try: person_show=name = request.session["Uid"] except: return render_to_response( "login.html",{'nameerror':'非法'}) billid = request.POST["billid"] money = request.POST["money"] time = request.POST["time"] payname = request.POST["payname"] note = request.POST["note"] namecontent = request.POST["namecontent"] numbercontent = request.POST["numbercontent"] bill_sqlid = request.POST["bill_sqlid"] pwd = request.POST["pwd"] obj1 = Bill.objects.get(id = bill_sqlid) fini_person=obj1.transactor obj2 = User.objects.get(uid=fini_person) if obj2.password != pwd: error='密码不正确' accountedit=Account.objects.all().order_by("project_id") return render_to_response("accountinput_edit.html",locals()) obj3=Prokindaccount.objects.get( proid = obj1.proid , payname = obj1.paykind ) obj3.money_cost=obj3.money_cost - obj1.money obj3.save() obj6=Prokindaccount.objects.get( proid = obj1.proid , payname = payname ) obj6.money_cost=obj6.money_cost + string.atof(money) obj6.save() obj4=Account.objects.get( project_id =obj1.proid ) obj4.money_cost = obj4.money_cost - obj1.money + string.atof(money) obj4.save() obj5 = Billchange_record(transactor = obj1.transactor,billsql_id = obj1.id,time = datetime.datetime.now(),proid = obj1.proid,operation= u'修改',) obj5.save() obj1.money=string.atof(money) obj1.time = time obj1.note=note obj1.paykind=payname obj1.name=namecontent obj1.bill_id=billid obj1.change=True obj1.save() device_del = Billdevice_record.objects.filter(Bill_sqlid = bill_sqlid) device_del.delete() str1=namecontent str2=numbercontent s1 = str1.split(',') s2 = str2.split(',') for i in range(0,len(s2)-1): bsave = Billdevice_record(Bill_sqlid = obj1.id, proid = obj1.proid,name = s1[i],number = string.atof(s2[i]),paykind = payname,) bsave.save() error='修改成功' accountedit=Account.objects.all().order_by("project_id") return render_to_response("accountinput_edit.html",locals())
def accountinput_create_input(request): try: person_show=name = request.session["Uid"] except: return render_to_response( "login.html",{'nameerror':'非法'}) time=request.GET["time"] money=request.GET["money"] pid=request.GET["pid"] billid=request.GET["billid"] note=request.GET["note"] paykind=request.GET["paykind"] namecontent=request.GET["namecontent"] numcontent = request.GET["numcontent"] person_id=request.session["Uid"] s=Bill(time = time,name = namecontent,money = string.atof(money),transactor = person_id,note = note,paykind = paykind,proid = pid,change = False, bill_id=billid,) s.save() str1=namecontent str2=numcontent s1 = str1.split(',') s2 = str2.split(',') if numcontent != "": for i in range(0,len(s2)-1): bsave = Billdevice_record(Bill_sqlid = s.id, proid = pid,name = s1[i],number = string.atof(s2[i]),paykind = paykind,) bsave.save() a=Account.objects.get(project_id=pid) a.money_cost =+a.money_cost+string.atof(money) a.save() b=Prokindaccount.objects.get(proid=pid,payname=paykind) b.money_cost=b.money_cost+string.atof(money) b.save() alldata=[] onedata = [0,0] onedata[0] = "1" onedata[1] = '2' alldata.append(onedata) data = simplejson.dumps(alldata) return HttpResponse(data, 'application/javascript')