def updItem():
            if (self.operationL.text(
            ) == "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Update Item</span></p></body></html>"
                ):
                if (self.itemNameI.text() == "" or self.priceI.text() == ""):
                    Ui_MainWindow1.pop(
                        Ui_MainWindow1,
                        "Please enter values in Item Name and Price fields")
                else:
                    if (self.priceI.text().isnumeric() == True):
                        itemname = self.itemNameI.text()
                        price = self.priceI.text()
                        print(itemname, price)
                        cs = Sales()
                        cs.updItem(itemname, price)
                        self.itemNameI.setText("")
                        self.priceI.setText("")
                        Ui_MainWindow1.pop(Ui_MainWindow1, "Item Updated!!")
                    else:
                        Ui_MainWindow1.pop(Ui_MainWindow1,
                                           "Enter a valid Price value")

            else:
                self.operationL.setText(
                    "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Update Item</span></p></body></html>"
                )
                self.itemNameI.setText("")
                self.priceI.setText("")
                self.priceI.setEnabled(True)
 def addfromCombo():
     cs = Sales()
     price = cs.getItemPrice(str(self.itemDropDown.currentText()))
     self.selectTE.setText(self.selectTE.toPlainText() +
                           str(self.itemDropDown.currentText()) + "\t" +
                           str(price) + "\n")
     self.amount = self.amount + price
     self.pointsDispL_2.setText(
         "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">{}</span></p></body></html>"
         .format(self.amount))
def MenuSales(EmployeeID):
    while True:
        print("\t\t\t Sales Management\n")
        print(
            "================================================================="
        )
        print("1. Sale")
        print("2. Search Record by Date")
        print("3. Search Record by Employee ID")
        print("4. Print all Sales data over time")
        print("5. Return to Main Menu")
        print(
            "================================================================="
        )
        options = int(input("Enter between 1 to 5 -------> : "))
        if options == 1:
            Sales.insertSales(EmployeeID)
        elif options == 2:
            Sales.searchSalesByDate()
        elif options == 3:
            Sales.searchSalesByEmployeeID()
        elif options == 4:
            Sales.printAllSalesTable()
        elif options == 5:
            print('\n' * 5)
            return
        else:
            print("Wrong Choice.....Enter your options again")
            x = input("Enter any key to continue")
Beispiel #4
0
def MenuSales():
    while True:
        Purchases.clrscreen()
        print("\t\t\t Sales Record Management\n")
        print(
            "================================================================="
        )
        print("1. Add Sales Record")
        print("2. Search Sales Record")
        print("3. Delete Sales Record")
        print("4. Update Sales Record")
        print("5. Return to Main Menu")
        print(
            "================================================================="
        )
        choice = int(input("Enter Choice between 1 to 5 ------> : "))
        if choice == 1:
            Sales.insertData()
        elif choice == 2:
            Sales.searchData()
        elif choice == 3:
            Sales.deleteData()
        elif choice == 4:
            Sales.updateData()
        elif choice == 5:
            return
        else:
            print("Wrong Choice.....Enter Your Choice again")
            x = input("Enter any key to continue")
 def confirmPurchase():
     final_amount = self.amount
     if (self.operationL.text(
     ) == "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Money Purchase</span></p></body></html>"
         ):
         if (self.custNoI.text() == ""
                 or self.custNoI.text().isnumeric() == False):
             Ui_MainWindow1.pop(
                 Ui_MainWindow1,
                 "Please enter valid value in Mobile field")
         else:
             phone = int(self.custNoI.text())
             s = Sales()
             Ui_MainWindow1.pop(Ui_MainWindow1,
                                s.mnyPurchase(phone, final_amount))
             self.points = s.pntUpdate(final_amount, phone)
             self.pointsDispL.setText(
                 "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">{}</span></p></body></html>"
                 .format(self.points))
     else:
         if (self.custNoI.text() == ""
                 or self.custNoI.text().isnumeric() == False):
             Ui_MainWindow1.pop(
                 Ui_MainWindow1,
                 "Please enter valid value in Mobile field")
         else:
             phone = int(self.custNoI.text())
             s = Sales()
             aa = s.pntPurchase(phone, final_amount)
             Ui_MainWindow1.pop(Ui_MainWindow1, aa[0])
             self.pointsDispL.setText(
                 "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">{}</span></p></body></html>"
                 .format(aa[1]))
def create_sales():
    print('Enter the date :: ')
    date = input()
    print('Enter the product number :: ')
    prod_num = int(input())
    print('Enter the product name :: ')
    prod_name = input()
    print('Enter the product type [Grocery/Dairy/Cosmetics] ::')
    prod_type = input()
    print('Enter the product price ::')
    price = float(input())
    print('Enter the number of products ::')
    quantity = int(input())
    sal.add_product(date=date,
                    prod_num=prod_num,
                    prod_name=prod_name,
                    prod_type=prod_type,
                    price=price,
                    quantity=quantity)
        def delItem():
            if (self.operationL.text(
            ) == "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Delete Item</span></p></body></html>"
                ):
                if (self.itemNameI.text() == ""):
                    Ui_MainWindow1.pop(
                        Ui_MainWindow1,
                        "Please enter value in Item Name field")
                else:
                    itemname = self.itemNameI.text()
                    print(itemname)
                    cs = Sales()
                    cs.delItem(itemname)
                    self.itemNameI.setText("")
                    self.priceI.setText("")
                    Ui_MainWindow1.pop(Ui_MainWindow1, "Item Deleted!!")

            else:
                self.operationL.setText(
                    "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Delete Item</span></p></body></html>"
                )
                self.itemNameI.setText("")
                self.priceI.setText("")
                self.priceI.setEnabled(False)
Beispiel #8
0
 operation = input("The action you will take:")
 if operation == "1":
     Users.Datum().new_user_login()
     break
 elif operation == "2":
     user = Users.Datum().user_control()
     if user == 1:
         Admin.Admin().admin_control()
     else:
         print(
             "******************\nTo view product prices '1'\nFor buy '2'\nTo exit 'q' \nPress....\n******************"
         )
         b = input("Enter value:")
         if b == "1":
             Products.Datum().Products_info()
             break
         elif b == "2":
             Sales.Sales(user.user_name)
         elif b == "q":
             print("Goodbye")
             break
         else:
             print("Invalid transaction....")
 elif operation == "3":
     Mail.Mail().password_control()
     break
 elif operation == "q":
     print("Goodbye")
     break
 else:
     print("Invalid transaction....")
    games = sc.textFile("games.txt")
    games = games.map(lambda line: gf.Game(line)).persist()
    impacts = games.map(lambda line:(line.Name ,game.get_feature(line.Desc))).map(lambda list: (list[0], game.get_Effect(list[1]))).map(lambda effect:(effect[0],gf.Impact(int(effect[1])).name)).persist()
    pos = impacts.filter(lambda line: "Positive" in line).collect()
    neg = impacts.filter(lambda line: "Negative" in line).collect()

    # Resultat Ausgeben
    func.print_games_effect(GAMES_FILE_POSITIVE, pos)
    func.print_games_effect(GAMES_FILE_NEGATIVE, neg)


# ----------------------- STATISTICS
if "true" in conf.get("STATISTICS"):

    sales = sc.textFile("sales.csv").map(lambda line: s.Sales(line)).persist()

    # Histogramm
    histogram = sales.filter(lambda sale: not ("NA_Sales" in str(sale.Global_Sales)) and not (not str(sale.Global_Sales)))\
        .map(lambda sale: (float(sale.Global_Sales), 1 )).reduceByKey(lambda a, b: a+b).persist()

    spark = SparkSession(sc)
    _df = histogram.toDF(["Name", "Frequency"]).distinct()
    df = _df.toPandas()
    df = df.drop_duplicates()
    #df.pivot(index='Year', columns='Genre', values='Price')
    df.plot.hist(x='Name', y='Frequency')
    #df.plot.line( subplots=True , x='Genre', y='Anteil')
    plt.savefig('Histogram.png')

def display_sale_record(prod_num):
    sal.display(prod_num)
def modify_sales(prod_num):
    sal.modify_product(prod_num)
Beispiel #12
0
'''
author = Megi Beca
'''

import Sales
import Formatter
import Pay
import time

end = True
while end:
    request = input(
        "Pick a letter:\nA = Identify thhe persecnt yoy saved.\nB = Identify what level of savings you got.\n"
        "C = Identify how much you owe or how much change you are owed.\nD = Format a receipt.\nE = Calculate how "
        "much of a bonus you reseaved this year.\nF = Calculate your yearly income.\n"
    ).upper()
    if request == "A":
        Sales.identifying_percent_off()
    elif request == "B":
        Sales.identifying_savings()
    elif request == "C":
        Sales.change()
    elif request == "D":
        Formatter.formatting_receipts()
    elif request == "E":
        Pay.bonuses()
    elif request == "F":
        Pay.income()
    time.sleep(5)
Beispiel #13
0
#homework 7 test file

from Sales import*

comp1=Sales()
print 'Enter an invalid input and then 4 for sales:'
comp1.getSales()

comp1.setName('bugs bunny') #sets company name to bugs bunny
print comp1.getName() #should print 'bugs bunny'

comp2=Sales('marilyn')


comp1.display() # should print bugs bunny \n 16
comp2.display() # should print marilyn \n 0
Beispiel #14
0
 def __init__(self):
     # self.accountValue=0     ## this could be in the inventory:Class-Attribute
     self.name = ''
     self.age = 0
     self.inventory = Inventory.Inventory()
     self.daySales = Sales.Sales()
    def setupUi4(self, MainWindow):
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.bgL = QtWidgets.QLabel(self.centralwidget)
        self.bgL.setGeometry(QtCore.QRect(0, 0, 799, 461))
        self.bgL.setText("")
        self.bgL.setPixmap(
            QtGui.QPixmap("C:/Users/vinay/Desktop/Xtras/cool-age/bg_wlpr.jpg"))
        self.bgL.setScaledContents(True)
        self.bgL.setObjectName("bgL")
        self.pointsDispL = QtWidgets.QLabel(self.centralwidget)
        self.pointsDispL.setGeometry(QtCore.QRect(130, 400, 131, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.pointsDispL.setFont(font)
        self.pointsDispL.setObjectName("pointsDispL")
        self.pointsL = QtWidgets.QLabel(self.centralwidget)
        self.pointsL.setGeometry(QtCore.QRect(50, 400, 81, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.pointsL.setFont(font)
        self.pointsL.setObjectName("pointsL")
        self.operationL = QtWidgets.QLabel(self.centralwidget)
        self.operationL.setGeometry(QtCore.QRect(50, 70, 211, 31))
        self.operationL.setObjectName("operationL")
        self.moneyB = QtWidgets.QPushButton(self.centralwidget)
        self.moneyB.setGeometry(QtCore.QRect(40, 40, 111, 23))
        self.moneyB.setObjectName("moneyB")
        self.pointsB = QtWidgets.QPushButton(self.centralwidget)
        self.pointsB.setGeometry(QtCore.QRect(160, 40, 111, 23))
        self.pointsB.setObjectName("pointsB")
        self.addItemB = QtWidgets.QPushButton(self.centralwidget)
        self.addItemB.setGeometry(QtCore.QRect(50, 360, 75, 23))
        self.addItemB.setObjectName("addItemB")
        self.confirmPurchaseB = QtWidgets.QPushButton(self.centralwidget)
        self.confirmPurchaseB.setGeometry(QtCore.QRect(140, 360, 121, 23))
        self.confirmPurchaseB.setObjectName("confirmPurchaseB")
        self.itemDropDown = QtWidgets.QComboBox(self.centralwidget)
        self.itemDropDown.setGeometry(QtCore.QRect(50, 120, 211, 22))
        self.itemDropDown.setObjectName("itemDropDown")
        self.itemDropDown.addItem("")
        self.back = QtWidgets.QPushButton(self.centralwidget)
        self.back.setGeometry(QtCore.QRect(710, 370, 75, 23))
        self.back.setObjectName("back")
        self.selectTE = QtWidgets.QTextEdit(self.centralwidget)
        self.selectTE.setEnabled(False)
        self.selectTE.setGeometry(QtCore.QRect(270, 120, 201, 231))
        self.selectTE.setObjectName("selectTE")
        self.selectL = QtWidgets.QLabel(self.centralwidget)
        self.selectL.setGeometry(QtCore.QRect(270, 90, 101, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.selectL.setFont(font)
        self.selectL.setObjectName("selectL")
        self.pointsL_2 = QtWidgets.QLabel(self.centralwidget)
        self.pointsL_2.setGeometry(QtCore.QRect(50, 330, 81, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.pointsL_2.setFont(font)
        self.pointsL_2.setObjectName("pointsL_2")
        self.pointsDispL_2 = QtWidgets.QLabel(self.centralwidget)
        self.pointsDispL_2.setGeometry(QtCore.QRect(130, 330, 131, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.pointsDispL_2.setFont(font)
        self.pointsDispL_2.setObjectName("pointsDispL_2")
        self.custNoL = QtWidgets.QLabel(self.centralwidget)
        self.custNoL.setGeometry(QtCore.QRect(50, 300, 81, 21))
        self.custNoL.setFont(font)
        self.custNoL.setObjectName("custNoL")
        self.custNoI = QtWidgets.QLineEdit(self.centralwidget)
        self.custNoI.setGeometry(QtCore.QRect(130, 300, 131, 21))
        self.custNoI.setObjectName("custNoI")
        self.custStatsB = QtWidgets.QPushButton(self.centralwidget)
        self.custStatsB.setGeometry(QtCore.QRect(580, 120, 161, 23))
        self.custStatsB.setObjectName("custStatsB")
        self.statsL = QtWidgets.QLabel(self.centralwidget)
        self.statsL.setGeometry(QtCore.QRect(580, 90, 101, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.statsL.setFont(font)
        self.statsL.setObjectName("statsL")
        self.salesStatsB = QtWidgets.QPushButton(self.centralwidget)
        self.salesStatsB.setGeometry(QtCore.QRect(580, 150, 161, 23))
        self.salesStatsB.setObjectName("salesStatsB")
        self.statsL_2 = QtWidgets.QLabel(self.centralwidget)
        self.statsL_2.setGeometry(QtCore.QRect(580, 200, 101, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.statsL_2.setFont(font)
        self.statsL_2.setObjectName("statsL_2")
        self.salesPredB = QtWidgets.QPushButton(self.centralwidget)
        self.salesPredB.setGeometry(QtCore.QRect(580, 230, 161, 23))
        self.salesPredB.setObjectName("salesPredB")
        self.excelB = QtWidgets.QPushButton(self.centralwidget)
        self.excelB.setGeometry(QtCore.QRect(580, 310, 161, 23))
        self.excelB.setObjectName("excelB")
        self.statsL_3 = QtWidgets.QLabel(self.centralwidget)
        self.statsL_3.setGeometry(QtCore.QRect(580, 280, 101, 21))
        font = QtGui.QFont()
        font.setFamily("Calibri")
        font.setPointSize(11)
        self.statsL_3.setFont(font)
        self.statsL_3.setObjectName("statsL_3")
        MainWindow.setCentralWidget(self.centralwidget)

        def moneyP():
            self.amount = 0
            self.points = 0
            self.operationL.setText(
                "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Money Purchase</span></p></body></html>"
            )
            self.selectTE.setText("")
            self.pointsDispL_2.setText(
                "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">0</span></p></body></html>"
            )
            self.pointsDispL.setText(
                "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">0</span></p></body></html>"
            )
            self.amount = 0
            self.points = 0

        def pointP():
            self.amount = 0
            self.points = 0
            self.operationL.setText(
                "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Points Purchase</span></p></body></html>"
            )
            self.selectTE.setText("")
            self.pointsDispL_2.setText(
                "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">0</span></p></body></html>"
            )
            self.pointsDispL.setText(
                "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">0</span></p></body></html>"
            )
            self.amount = 0
            self.points = 0

        def addfromCombo():
            cs = Sales()
            price = cs.getItemPrice(str(self.itemDropDown.currentText()))
            self.selectTE.setText(self.selectTE.toPlainText() +
                                  str(self.itemDropDown.currentText()) + "\t" +
                                  str(price) + "\n")
            self.amount = self.amount + price
            self.pointsDispL_2.setText(
                "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">{}</span></p></body></html>"
                .format(self.amount))

        def confirmPurchase():
            final_amount = self.amount
            if (self.operationL.text(
            ) == "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Money Purchase</span></p></body></html>"
                ):
                if (self.custNoI.text() == ""
                        or self.custNoI.text().isnumeric() == False):
                    Ui_MainWindow1.pop(
                        Ui_MainWindow1,
                        "Please enter valid value in Mobile field")
                else:
                    phone = int(self.custNoI.text())
                    s = Sales()
                    Ui_MainWindow1.pop(Ui_MainWindow1,
                                       s.mnyPurchase(phone, final_amount))
                    self.points = s.pntUpdate(final_amount, phone)
                    self.pointsDispL.setText(
                        "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">{}</span></p></body></html>"
                        .format(self.points))
            else:
                if (self.custNoI.text() == ""
                        or self.custNoI.text().isnumeric() == False):
                    Ui_MainWindow1.pop(
                        Ui_MainWindow1,
                        "Please enter valid value in Mobile field")
                else:
                    phone = int(self.custNoI.text())
                    s = Sales()
                    aa = s.pntPurchase(phone, final_amount)
                    Ui_MainWindow1.pop(Ui_MainWindow1, aa[0])
                    self.pointsDispL.setText(
                        "<html><head/><body><p><span style=\" font-weight:600; color:#ffffff;\">{}</span></p></body></html>"
                        .format(aa[1]))

        def csvfunction():
            Stats.exportCSV(Stats)
            Ui_MainWindow1.pop(Ui_MainWindow1,
                               "Files have been imported to your system!!")

        cs = Sales()
        items = cs.allItem()
        items1 = []
        i = 0
        while (i < len(items)):
            items1.insert(0, items[i][0])
            i = i + 1
        print(items1)
        self.itemDropDown.clear()
        self.itemDropDown.addItems(items1)
        self.retranslateUi4(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.back.clicked.connect(Ui_MainWindow1.open1)
        self.moneyB.clicked.connect(moneyP)
        self.pointsB.clicked.connect(pointP)
        self.addItemB.clicked.connect(addfromCombo)
        self.confirmPurchaseB.clicked.connect(confirmPurchase)
        self.custStatsB.clicked.connect(Stats.customerStats)
        self.salesStatsB.clicked.connect(Stats.salesStats)
        self.salesPredB.clicked.connect(Stats.salePredicition)
        self.excelB.clicked.connect(csvfunction)
Beispiel #16
0
import report
import customer

dailySales = []
userss={0:"NonRegistered",1:"Monica",2:"Begum",3:"Iyad",4:"Carmen", 5:"Eustaquio"}


#Show the user a menu to choose what he wants
print("Welcome to Pythunicorns POS. Dominating the european markets since 1913  ")
while(True):
    userInput = input("Please enter your command \nuse the following structure:\n For sale enter the following 'Sale #SKU:number #CC:number #ID:number \n"
                      "For adding new customers enter the following: 'Customer #ID:number ' \n For reports enter the following: 'report' or 'crm' \n for closing enter the following 'close' \n")
    userChoice=userInput.split(" ")[0].lower()
    userInputWithoutFirstCommand= " ".join(userInput.split(" ")[1:])
    if(userChoice == 'sale'):
        sale = Sales.extractCommandos(userInputWithoutFirstCommand , userss)
        dailySales.append(sale)
        print("You successfully regiestered a sale")
    elif(userChoice=='customer'):
        customerName = input("Please enter customer name ")
        id = userInput.split(" ")[1].split(":")[1];
        print(customer.create_user(userss ,id , customerName))
    elif(userChoice=='report'):
        report = report.build_cash_report(dailySales)
        print("Cash Sales for today are: " + str(report['cash_sales']))
        print("Credit Card Sales for today are " + str(report['cc_sales']))
    elif(userChoice=='crm'):
        crm = report.build_customer_report(dailySales)
        for k,v in crm.items():
                print(" Sales for Customer ID:" + k + " are  " + str(v))
    elif(userChoice=="close"):