예제 #1
0
 def showCatTot():
     UtilGp.sleep(2)
     UtilGp.clear()
     UtilGp.title('Reports(%s)' % ('Total Amount Spent on a Category', ))
     for valueCat in ndb.dbCat:
         print("%d %s" % (valueCat.catId, valueCat.category))
     choiceCatId = int(input("Enter Catgory ID\nYour Choice:"))
     isExist = False
     resCat = None
     for valueCat in ndb.dbCat:
         if valueCat.catId == choiceCatId:
             isExist = True
             resCat = valueCat
             break
     if isExist:
         dbTran = DbTranData.queryByCategory(ndb.dbTran, choiceCatId)
         amount = sum(list(map(lambda x: x.price, dbTran)))
         UtilGp.printCaptionData(
             ('Category', 'Total Amount Spent is'),
             (valueCat.category, 'Rs.%.2f' % (amount, )), 45)
         #print("Total Amount Spent for category %s is Rs.%f"%(valueCat.category,amount))
         print("****End of Report****")
         print()
         Shop.showFailure()
     else:
         print("You Category Not Exist.")
         Shop.showFailure()
예제 #2
0
 def Login(fnToCall, tranLoader, pageTitle='Login'):
     from dBase import ndb
     ndb.loadItemCard()
     UtilGp.clear()
     UtilGp.title(pageTitle)
     from CardData import DbCardData
     from dBase import ndb
     from frmPageShop import Shop
     cardNo = input("Enter your card number:")
     vRet = DbCardData.getCardObject(ndb.dbCard, cardNo)
     # print(vRet)
     if vRet[0]:
         valueCard = vRet[1]
         from getpass import getpass
         passCode = getpass("Enter your PIN:")
         # print("%s %s" % (cardNo, passCode))
         if valueCard.passCode == passCode:
             ndb.IsLoggedIn = True
             ndb.logInCard = valueCard
             tranLoader(valueCard, True)
             fnToCall()  #Shop.showCat()
         else:
             print("Incorrect PIN")
             Shop.showFailure()
     else:
         print("\nCard does not exits.\n")
         Shop.showFailure()
예제 #3
0
 def showAmountRange():
     UtilGp.sleep(2)
     UtilGp.clear()
     UtilGp.title('Reports(%s)' % ('Transactions within amount range', ))
     fromAmount = float(input("From Amount:"))
     toAmount = float(input("To Amount:"))
     #print(fromDate,toDate)
     dbTran = DbTranData.queryByAmount(ndb.dbTran, fromAmount, toAmount)
     DbTranData.printTran(dbTran)
     print("****End of Report****")
     print()
     Shop.showFailure()
예제 #4
0
 def showBySortedAmount():
     UtilGp.sleep(2)
     UtilGp.clear()
     UtilGp.title('Reports(%s)' % ('All Transactions sorted on amount', ))
     dbTran = DbTranData.queryAll(ndb.dbTran)
     dbTran.sort(key=lambda x: x.price)
     #print(dbTran)
     DbTranData.printTran(dbTran)
     print("****End of Report****")
     print()
     from frmPageShop import Shop
     Shop.showFailure()
예제 #5
0
 def mainMenu():
     UtilGp.sleep(2)
     UtilGp.clear()
     from frmPageHome import Home
     from frmPageApplyCard import ApplyCard
     from frmPageShop import Shop
     from frmPageReport import Report
     choice = Home.show()
     if choice == 1:
         ApplyCard.show()
     elif choice == 2:
         Shop.show()
     elif choice == 3:
         Report.show()
예제 #6
0
 def showDateRange():
     UtilGp.sleep(2)
     UtilGp.clear()
     UtilGp.title('Reports(%s)' % ('Transactions between two dates', ))
     fromDate = input("From Date(dd-MM-YYYY):")
     toDate = input("To Date  (dd-MM-YYYY):")
     fromDate = UtilGp.strToDate(fromDate + ' 00:00:00')
     toDate = UtilGp.strToDate(toDate + ' 23:59:00')
     #print(fromDate,toDate)
     dbTran = DbTranData.queryByDateRange(ndb.dbTran, fromDate, toDate)
     DbTranData.printTran(dbTran)
     print("****End of Report****")
     print()
     from frmPageShop import Shop
     Shop.showFailure()
예제 #7
0
 def showByCat():
     UtilGp.sleep(2)
     UtilGp.clear()
     UtilGp.title('Reports(%s)' % ('Transactions of a Category', ))
     for valueCat in ndb.dbCat:
         print("%d %s" % (valueCat.catId, valueCat.category))
     choiceCatId = int(input("Enter Catgory ID\nYour Choice:"))
     isExist = False
     resCat = None
     for valueCat in ndb.dbCat:
         if valueCat.catId == choiceCatId:
             isExist = True
             resCat = valueCat
             break
     if isExist:
         dbTran = DbTranData.queryByCategory(ndb.dbTran, choiceCatId)
         DbTranData.printTran(dbTran)
         print("****End of Report****")
         print()
         Shop.showFailure()
     else:
         print("You Category Not Exist.")
         Shop.showFailure()
예제 #8
0
    def show():
        UtilGp.clear()
        UtilGp.title('Applying Card')
        print("Loading...\r",end="")
        UtilGp.sleep(2)		
        name=input("%-30s:"%"Enter Name")
        mobileNo=input("%-30s:"%"Enter Mobile Number")
        if not UtilGp.isValidDigit(mobileNo):
            print("Invalid Mobile Number")
            Shop.showFailure()
            return
        dob=input("%s\n%-30s:"%("Enter Date of Birth","(DD-MM-YYYY)"))
        if not UtilGp.isValidDate(dob):
            print("Invalid Date Format")
            Shop.showFailure()
            return
        dob = dob + ' 00:00:00'
        dobDate = UtilGp.strToDate(dob)
        if UtilGp.age(dobDate)<18:
            print("Minimum age to apply should be 18 years")
            Shop.showFailure()
            return
        netSalary=input("%-30s:"%"Enter Net Annual Salary")
        if not UtilGp.isValidDigit(netSalary,False):
            print("Invalid Salary Input")
            Shop.showFailure()
            return
        netSalary =float(netSalary)
        if netSalary < 300000:
            print("Minimum Salary to apply for Credit Card is Rs.300000.00")
            Shop.showFailure()
            return
        adharNo = input("%-30s:" % "ADHAAR Number")
        if not UtilGp.isValidDigit(adharNo,True,12):
            print("Invalid ADHAAR number")
            Shop.showFailure()
            return
        adharCount = DbCardData.countCardByAdhaar(ndb.dbCard,adharNo)
        if adharCount>0:
            print("Only one credit card per user is allowed")
            Shop.showFailure()
            return
        card = CardData(name,mobileNo,dobDate,netSalary,adharNo)
        card.preCardRegister()
        passCode=input("%-30s:" % "Select Your PIN (4-Digit)")
        if not UtilGp.isValidDigit(passCode,True,4):
            print("Invalid PIN format")
            Shop.showFailure()
            return
        card.passCode = passCode


        DbCardData.addToCard(card)
        print();print("Congratulation!\nYour SBI Credit Card is Approved.");print();
        UtilGp.printCaptionData(('Card No', 'Credit Limit', 'Card Type'),
                                (card.cardNo, UtilGp.priceToStr(card.creditLimit), card.cardType), 20)
        Shop.showFailure()