如何在python中解决企业软件问题?

问题描述

在这里,我已经用python开发了企业软件。我有一个数据库,其中有bill_details表和paid_details表。 bill_details表将包含amount to be paiddatename。在paid_details中,表中有namepaid amount,这就是这种情况。

如果用户想知道payment dues数量,那么我应该打印due amount

例如 bill_details

name        amt_pending         date

xyz          100               20-09-2020
xyz          50               21-09-2020
xyz          200               22-09-2020
xyz          20               23-09-2020

在付款明细表paid_details

name          paid_amt        date

xyz             100          21-09-2020
xyz             50           22-09-2020

这是我的桌子。我需要这样的输出

xyz

22-09-2020      200
23-09-2020      20

我需要将待付款金额与已付款金额相加,并显示待付款金额。我该如何实现? 我已经尝试使用list了,但是行得通,但是我无法将这些日期与待定金额对应。请帮助我。

添加了我尝试过的代码

date  = [1,2,3,4,5,6,7,8,9,10]
pending  = [10,100,6]
paid  = [10,5]
c  = pending.copy()

# clen=len(c)

for i in range(len(paid)):
    print(paid[i],pending[i],i)
    # alen = len(a)

    if(paid[i]-pending[i]==0):
        c.remove(paid[i])
    else:
        c[i] = pending[i] - paid[i]
        # print(a[-1]-b[i])
        

print(pending)

解决方法

尝试一下:

fields = ['Name','amt_pending','date','paid_amt'] 
  
rows = [ ['xyz',100,'20-09-2020',100],['xyz',50,'21-09-2020',50],200,'22-09-2020',0]] 
  



for i in rows:
            
    if i[1] == i[3]:
        print('no pending remaining')
    else:
        a = i[1] - i[3]
        print("pending amount is: " + str(a) + ' on ' + str(i[2]))