Exemple #1
0
def accountadd_add_input(request):
    try:
        person_show=name = request.session["Uid"]
    except:
        return render_to_response( "login.html",{'nameerror':'非法'})
    proid=request.POST["objid"]
    money=request.POST["addmoney"]
 
    d1 = Project.objects.get(pid = proid)
    obj1 = Account.objects.get(project_id=proid)
    obj1.money_act = obj1.money_act+(string.atof(money)*10000)
    obj1.save()
    obj2 = Accountadd_record( project_id = d1,time=datetime.datetime.now(),money_add=(string.atof(money)*10000),)
    obj2.save()
    error='录入成功'
    account_add_edit = Account.objects.all()
    return render_to_response("accountadd.html",locals())
Exemple #2
0
def accountcreate_create(request):
    try:
        person_show=name = request.session["Uid"]
    except:
        return render_to_response( "login.html",{'nameerror':'非法'})
    account=request.GET["account"]
    kindname=request.GET["kindname"]
    sum1=string.atof(request.GET["sum1"])
    proid=request.GET["proid"]
    firstm=string.atof(request.GET["firstm"])
    accid = request.GET["accid"]
    
    d1=Project.objects.get(pid = proid)
    str1=kindname
    str2=account
    s1 = str1.split(',')
    s2 = str2.split(',')
    
    if d1.iscreate == False:
        for i  in range(0,len(s1)-1):
            c1=s1[i]
            c2=string.atof(s2[i])
            b=Prokindaccount( proid = d1,payname = c1,money_sum = (c2 * 10000),money_cost = 0,buff = 0,)
            b.save()
        d1.iscreate=True
        d1.save()
        a=Account(project_id=d1,money_sum = (sum1 * 10000),money_act = (firstm * 10000),money_cost = 0,account_id = accid,)
        a.save()
        e=Accountadd_record(project_id = d1,time = datetime.datetime.now(),money_add = (firstm * 10000),)
        e.save()

    else:
        Prokindaccount.objects.filter(proid = proid).delete()
        for i  in range(0,len(s1)-1):
            c1=s1[i]
            c2=string.atof(s2[i])
            b=Prokindaccount( proid = d1,payname = c1,money_sum = (c2*10000),money_cost = 0,buff = 0,)
            b.save()
        Accountadd_record.objects.get(project_id = proid).delete()
        e=Accountadd_record(project_id = d1,time = datetime.datetime.now(),money_add = (firstm * 10000),)
        e.save()
        a=Account.objects.get(project_id = proid)
        a.money_sum= (sum1 * 10000)
        a.money_act = (firstm * 10000)
        a.account_id = accid
        a.save()
    alldata=[]
    onedata = [0,0]
    onedata[0] = "1"
    onedata[1] = '2'
    alldata.append(onedata)
    data = simplejson.dumps(alldata)
    return HttpResponse(data, 'application/javascript')