Ejemplo n.º 1
0
Archivo: test.py Proyecto: KGPython/scm
def index(req):
    numbers = 49962.01
    upp = mth.rmbupper(numbers)
    print(upp)
    return upp
Ejemplo n.º 2
0
def balanceArticle(request):
    grpCode = request.session.get('s_grpcode')       #用户所属单位
    s_suppname = request.session.get('s_suppname')   #用户所属单
    grpName = Constants.SCM_UNIT[grpCode]
    contracttype = request.session.get("s_contracttype")   #经营方式
    paytypeid = str(int(request.session.get("s_paytypeid")))   #经营方式

    sheetId = request.GET.get('sheetid','')
    queryAction = request.POST.get('actionTxt','')
    #更新确认状态
    if queryAction == 'check':
        balanceObj = Billhead0.objects.get(sheetid__contains=sheetId,grpcode=grpCode)
        balanceObj.status='Y'
        balanceObj.save()

    #结算通知单汇总      ,beginsdate,endsdate
    balance = Billhead0.objects.values("shopid","venderid","vendername","sheetid","paytype","begindate","enddate"
                                               ,"editdate","curdxvalue","payablemoney","kxinvoice","kxmoney","kxcash",
                                               "premoney","editor","checker","paychecker","contracttype","beginsdate","endsdate","advance")\
                                       .get(sheetid__contains=sheetId)
    #结算通知明细
    balanceItems = Billheaditem0.objects.values("inshopid","refsheettype","refsheetid","managedeptid","payabledate",
                                                "costvalue","costtaxvalue","costtaxrate","salevalue","dkrate","invoicesheetid")\
                                        .filter(sheetid__contains=sheetId).exclude(costvalue=0)\
                                        .order_by("inshopid","refsheettype","refsheetid")

    itemList = []
    itemShopId = None
    for item in balanceItems:
        shopid = item["inshopid"]
        if itemShopId != shopid:
            vlist = []
            itemList.append([shopid,vlist])

        vlist.append(item)
        itemShopId = item["inshopid"]

    itemList = sorted(itemList)

    #本期帐扣发票金额
    if balance.get('kxinvoice'):
        cfpkx = balance.get('kxinvoice')
    else:
        cfpkx = decimal.Decimal(0.0)

    #帐扣扣项 帐扣金额
    zkkx = balance.get('kxmoney')-balance.get('kxcash')

     #本期应付金额
    if balance.get('curdxvalue'):
        curdxValue = balance.get('curdxvalue')
    else:
        curdxValue = decimal.Decimal(0.0)

    if balance.get('payablemoney'):
        payableMoney = balance.get('payablemoney')
    else:
        payableMoney= decimal.Decimal(0.0)

    #预付款余额
    if balance.get('premoney'):
        premoney = balance.get('premoney')
    else:
        premoney = decimal.Decimal(0.0)

    if curdxValue == 0:
        invoicePay =payableMoney-cfpkx#应开票金额
        realPay = payableMoney-zkkx-premoney#实付金额
    else:
        invoicePay = curdxValue-cfpkx
        realPay = curdxValue-zkkx-premoney

    #实付金额大写
    realPayUpper = mtu.rmbupper(float(round(realPay,2)))
    #打印日期
    printDate = datetime.date.today()
    ssum1 = decimal.Decimal(0.0)
    ssum2 = decimal.Decimal(0.0)
    ssum3 = decimal.Decimal(0.0)
    try:
        conn = mtu.getMysqlConn()
        cur = conn.cursor()
        sql = """select InShopID,sum(CostValue) AS CostValue,SUM(CostTaxValue) AS CostTaxValue,sum(salevalue) AS SaleValue
                 from billheaditem0 where SheetID ='{sheetId}' group by InShopID""".format(sheetId=sheetId)
        cur.execute(sql)
        slist = cur.fetchall()
        sdict = {}
        for row in slist:
            ssum1 += row["CostValue"]
            ssum2 += (row["CostValue"]-row["CostTaxValue"])
            ssum3 += row["SaleValue"]
            sdict[row["InShopID"]] = [ row["CostValue"],(row["CostValue"]-row["CostTaxValue"]),row["SaleValue"]]
    except Exception as e:
        print(e)

    #应结金额总额
    totalCostValue = decimal.Decimal(0.0)
    #税金总额
    totalCostTax = decimal.Decimal(0.0)
    mdept = []
    for item in balanceItems:
        totalCostValue += item.get('costvalue',0)
        totalCostTax += item.get('costtaxvalue',0)
        item['managedeptid'] = str(item.get('managedeptid',0))
        mdept.append(item["managedeptid"])

    #查询管理部类:多个用逗号分隔
    mdept = list(set(mdept))
    orgList = BasOrg.objects.all().values("orgname", "orgcode")
    mdeptNames = [x["orgname"] for x in orgList if x["orgcode"] in mdept]
    mdeptName = ",".join(mdeptNames)

    #查询帐扣明细
    kxlist = findKxListBySheetId(sheetId)
    kxsum = decimal.Decimal(0.0)
    for item in kxlist:
        kxsum += item["kmoney"]

    jxList = findJxListBySheetId(sheetId)
    jxsum = decimal.Decimal(0.0)
    for item2 in jxList:
        jxsum += item2["kmoney"]

    return render(request,'user_settle_article_{ctype}.html'.format(ctype=contracttype),locals())
Ejemplo n.º 3
0
def balanceArticle(request):
    grpCode = request.session.get('s_grpcode')       #用户所属单位
    s_suppname = request.session.get('s_suppname')   #用户所属单
    grpName = Constants.SCM_UNIT[grpCode]
    contracttype = request.session.get("s_contracttype")   #经营方式
    paytypeid = str(int(request.session.get("s_paytypeid")))   #经营方式

    sheetId = request.GET.get('sheetid','')
    queryAction = request.POST.get('actionTxt','')
    #更新确认状态
    if queryAction == 'check':
        balanceObj = Billhead0.objects.get(sheetid__contains=sheetId,grpcode=grpCode)
        balanceObj.status='Y'
        balanceObj.save()

    #结算通知单汇总      ,beginsdate,endsdate
    balance = Billhead0.objects.values("shopid","venderid","vendername","sheetid","paytype","begindate","enddate"
                                               ,"editdate","curdxvalue","payablemoney","kxinvoice","kxmoney","kxcash",
                                               "premoney","editor","checker","paychecker","contracttype","beginsdate","endsdate","advance")\
                                       .get(sheetid__contains=sheetId)
    #结算通知明细
    balanceItems = Billheaditem0.objects.values("inshopid","refsheettype","refsheetid","managedeptid","payabledate",
                                                "costvalue","costtaxvalue","costtaxrate","salevalue","dkrate","invoicesheetid")\
                                        .filter(sheetid__contains=sheetId).exclude(costvalue=0)\
                                        .order_by("inshopid","refsheettype","refsheetid")

    itemList = []
    itemShopId = None
    for item in balanceItems:
        shopid = item["inshopid"]
        if itemShopId != shopid:
            vlist = []
            itemList.append([shopid,vlist])

        vlist.append(item)
        itemShopId = item["inshopid"]

    itemList = sorted(itemList)

    #本期帐扣发票金额
    if balance.get('kxinvoice'):
        cfpkx = balance.get('kxinvoice')
    else:
        cfpkx = decimal.Decimal(0.0)

    #帐扣扣项 帐扣金额
    zkkx = balance.get('kxmoney')-balance.get('kxcash')

     #本期应付金额
    if balance.get('curdxvalue'):
        curdxValue = balance.get('curdxvalue')
    else:
        curdxValue = decimal.Decimal(0.0)

    if balance.get('payablemoney'):
        payableMoney = balance.get('payablemoney')
    else:
        payableMoney= decimal.Decimal(0.0)

    #预付款余额
    if balance.get('premoney'):
        premoney = balance.get('premoney')
    else:
        premoney = decimal.Decimal(0.0)

    if curdxValue == 0:
        invoicePay =payableMoney-cfpkx#应开票金额
        realPay = payableMoney-zkkx-premoney#实付金额
    else:
        invoicePay = curdxValue-cfpkx
        realPay = curdxValue-zkkx-premoney

    #实付金额大写
    realPayUpper = mtu.rmbupper(float(round(realPay,2)))
    #打印日期
    printDate = datetime.date.today()
    ssum1 = decimal.Decimal(0.0)
    ssum2 = decimal.Decimal(0.0)
    ssum3 = decimal.Decimal(0.0)
    try:
        conn = mtu.getMysqlConn()
        cur = conn.cursor()
        sql = """select InShopID,sum(CostValue) AS CostValue,SUM(CostTaxValue) AS CostTaxValue,sum(salevalue) AS SaleValue
                 from billheaditem0 where SheetID ='{sheetId}' group by InShopID""".format(sheetId=sheetId)
        cur.execute(sql)
        slist = cur.fetchall()
        sdict = {}
        for row in slist:
            ssum1 += row["CostValue"]
            ssum2 += (row["CostValue"]-row["CostTaxValue"])
            ssum3 += row["SaleValue"]
            sdict[row["InShopID"]] = [ row["CostValue"],(row["CostValue"]-row["CostTaxValue"]),row["SaleValue"]]
    except Exception as e:
        print(e)

    #应结金额总额
    totalCostValue = decimal.Decimal(0.0)
    #税金总额
    totalCostTax = decimal.Decimal(0.0)
    mdept = []
    for item in balanceItems:
        totalCostValue += item.get('costvalue',0)
        totalCostTax += item.get('costtaxvalue',0)
        item['managedeptid'] = str(item.get('managedeptid',0))
        mdept.append(item["managedeptid"])

    #查询管理部类:多个用逗号分隔
    mdept = list(set(mdept))
    orgList = BasOrg.objects.all().values("orgname", "orgcode")
    mdeptNames = [x["orgname"] for x in orgList if x["orgcode"] in mdept]
    mdeptName = ",".join(mdeptNames)

    #查询帐扣明细
    kxlist = findKxListBySheetId(sheetId)
    kxsum = decimal.Decimal(0.0)
    for item in kxlist:
        kxsum += item["kmoney"]

    jxList = findJxListBySheetId(sheetId)
    jxsum = decimal.Decimal(0.0)
    for item2 in jxList:
        jxsum += item2["kmoney"]

    return render(request,'user_settle_article_{ctype}.html'.format(ctype=contracttype),locals())
Ejemplo n.º 4
0
def index():
    numbers = -17318.04
    upp = mth.rmbupper(numbers)
    print(upp)
    return upp