# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'homepage2.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets
import random
from receipt import Ui_receipt
import sqlite3


class usernaem(object):
    food_list = []

    def __init__(self, window):
        self.window = window

    ################################################### ENABLING THE TEXTBOXES ##################################
    #########Meal##########

    def cf1_function(self, cf1, tf1):
        if self.cf1.isChecked():
            self.tf1.setEnabled(True)
        else:
            self.tf1.setEnabled(False)

    def cf2_function(self, cf2, tf2):
        if self.cf2.isChecked():
            self.tf2.setEnabled(True)
            print("0")
        else:
            self.tf2.setEnabled(False)

    def cf3_function(self, cf3, tf3):
        if self.cf3.isChecked():
            self.tf3.setEnabled(True)
        else:
            self.tf3.setEnabled(False)

    def cf4_function(self, cf4, tf4):
        if self.cf4.isChecked():
            self.tf4.setEnabled(True)
        else:
            self.tf4.setEnabled(False)

            ############ Drinks############

    def cd1_function(self, cd1, td1):
        if self.cd1.isChecked():
            self.td1.setEnabled(True)
        else:
            self.td1.setEnabled(False)

    def cd2_function(self, cd2, td2):
        if self.cd2.isChecked():
            self.td2.setEnabled(True)
        else:
            self.td2.setEnabled(False)

    def cd3_function(self, cd3, td3):
        if self.cd3.isChecked():
            self.td3.setEnabled(True)
        else:
            self.td3.setEnabled(False)

    def cd4_function(self, cd4, td4):
        if self.cd4.isChecked():
            self.td4.setEnabled(True)
        else:
            self.td4.setEnabled(False)
            ############ Meal ##############

    def cp1_function(self, cp1, tp1):
        if self.cp1.isChecked():
            self.tp1.setEnabled(True)
        else:
            self.tp1.setEnabled(False)

    def cp2_function(self, cp2, tp2):
        if self.cp2.isChecked():
            self.tp2.setEnabled(True)
        else:
            self.tp2.setEnabled(False)

    def cp3_function(self, cp3, tp3):
        if self.cp3.isChecked():
            self.tp3.setEnabled(True)
        else:
            self.tp3.setEnabled(False)

    def cp4_function(self, cp4, tp4):
        if self.cp4.isChecked():
            self.tp4.setEnabled(True)
        else:
            self.tp4.setEnabled(False)
            ############ Cakes ##############

    def cde1_function(self, cde1, tc1):
        if self.cde1.isChecked():
            self.tc1.setEnabled(True)
        else:
            self.tc1.setEnabled(False)

    def cde2_function(self, cde2, tc2):
        if self.cde2.isChecked():
            self.tc2.setEnabled(True)
        else:
            self.tc2.setEnabled(False)

    def cde3_function(self, cde3, tc3):
        if self.cde3.isChecked():
            self.tc3.setEnabled(True)
        else:
            self.tc3.setEnabled(False)

    def cde4_function(self, cde4, tc4):
        if self.cde4.isChecked():
            self.tc4.setEnabled(True)
        else:
            self.tc4.setEnabled(False)
            ######################### Drinks ###################

    def cs1_function(self, cs1, ts1):
        if self.cs1.isChecked():
            self.ts1.setEnabled(True)
        else:
            self.ts1.setEnabled(False)

    def cs2_function(self, cs2, ts2):
        if self.cs2.isChecked():
            self.ts2.setEnabled(True)
        else:
            self.ts2.setEnabled(False)

    def cs3_function(self, cs3, ts3):
        if self.cs3.isChecked():
            self.ts3.setEnabled(True)
        else:
            self.ts3.setEnabled(False)

    def cs4_function(self, cs4, ts4):
        if self.cs4.isChecked():
            self.ts4.setEnabled(True)
        else:
            self.ts4.setEnabled(False)
        ########################################################### Database####################

    #################################################### Total #################################################
    def total_amount(self, item10=None):

        item1 = float(self.tf1.text())
        item2 = float(self.tf2.text())
        # self.food_list.append("Bolanni")
        # self.food_list.append(item1)
        item3 = float(self.tf3.text())
        item4 = float(self.tf4.text())
        item5 = float(self.td1.text())
        item6 = float(self.td2.text())
        item7 = float(self.td3.text())
        item8 = float(self.td4.text())
        item9 = float(self.tp1.text())
        # item10 = float(self.tp2.text())
#        item11 = float(self.tp3.text())
#        item12 = float(self.tp4.text())
        item13 = float(self.tc1.text())
        item14 = float(self.tc2.text())
        item15 = float(self.tc3.text())
        item16 = float(self.tc4.text())
        item17 = float(self.ts1.text())
        # item18 = float(self.ts2.text())
        # item19 = float(self.ts3.text())
#        item20 = float(self.ts4.text())

        total = str((item1 * 120) + (item2 * 300) + (item3 * 350) + (item4 * 280) + (item5 * 100) + (item6 * 80) + (
                item7 * 50) + (item8 * 60) +
                    (item13 * 300) + (item14 * 320) + (item15 * 180) + (item16 * 190) + (item9 * 550) + (
                            item10 * 500) +
                    #(item11 * 450) +
                    #(item12 * 150) +
                    (item17 * 250)
                    #(item18 * 180) + (item19 * 210)
                    # (item20 * 200)
                    )


        self.totla_pay.setText(total)
        ####################################### RESET ##########################################

    def reset_button(self):
        ######################################### CHECKBOXES ##############################
        self.cd1.setChecked(False)
        self.cd2.setChecked(False)
        self.cd3.setChecked(False)
        self.cd4.setChecked(False)

        self.cf1.setChecked(False)
        self.cf2.setChecked(False)
        self.cf3.setChecked(False)
        self.cf4.setChecked(False)

        self.cp1.setChecked(False)
        # self.cp2.setChecked(False)
        # self.cp3.setChecked(False)
        # self.cp4.setChecked(False)

        self.cs1.setChecked(False)
        # self.cs2.setChecked(False)
        # self.cs3.setChecked(False)
        # self.cs4.setChecked(False)

        self.cde1.setChecked(False)
        self.cde2.setChecked(False)
        self.cde3.setChecked(False)
        self.cde4.setChecked(False)

        ################################# LINE EDIT ##############################################

        self.totla_pay.setText("0")

        ###################################### LINE EDITS##########################################

        self.tf1.setEnabled(False)
        self.tf1.setText("0")

        self.tf2.setEnabled(False)
        self.tf2.setText("0")

        self.tf3.setEnabled(False)
        self.tf3.setText("0")

        self.tf4.setEnabled(False)
        self.tf4.setText("0")

        self.td1.setEnabled(False)
        self.td1.setText("0")

        self.td2.setEnabled(False)
        self.td2.setText("0")

        self.td3.setEnabled(False)
        self.td3.setText("0")

        self.td4.setEnabled(False)
        self.td4.setText("0")

        self.tp1.setEnabled(False)
        self.tp1.setText("0")

        # self.tp2.setEnabled(False)
        # self.tp2.setText("0")

        # self.tp3.setEnabled(False)
        # self.tp3.setText("0")

        # self.tp4.setEnabled(False)
        # self.tp4.setText("0")

        self.tc1.setEnabled(False)
        self.tc1.setText("0")

        self.tc2.setEnabled(False)
        self.tc2.setText("0")

        self.tc3.setEnabled(False)
        self.tc3.setText("0")

        self.tc4.setEnabled(False)
        self.tc4.setText("0")

        self.ts1.setEnabled(False)
        self.ts1.setText("0")

        # self.ts2.setEnabled(False)
        # self.ts2.setText("0")

        # self.ts3.setEnabled(False)
        # self.ts3.setText("0")

        # self.ts4.setEnabled(False)
        # self.ts4.setText("0")

    ########################################################### RECEIPT ################################################
    def view_receipt(self):

        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_receipt()
        self.ui.setupUi(self.window)
        self.ui.display(self.tf1.text(), self.tf2.text(), self.totla_pay.text(), self.tf3.text(), self.tf4.text(),self.td1.text(), self.td2.text(), self.td3.text(), self.td4.text(),
                        self.tc1.text(), self.tc2.text(), self.tc3.text(), self.tc4.text(), self.ts1.text(), self.tp1.text())
        # self.window.close()

        self.window.show()

    def setupUi(self, Homewindow):
        Homewindow.setObjectName("Homewindow")
        Homewindow.setEnabled(True)
        Homewindow.resize(1114, 935)
        self.centralwidget = QtWidgets.QWidget(Homewindow)
        self.centralwidget.setAutoFillBackground(False)
        self.centralwidget.setObjectName("centralwidget")


        # layout = QtWidgets.QVBoxLayout(self.centralwidget)
        # self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
        # layout.addWidget(self.scrollArea)
        # self.scrollAreaWidgetContents = QtWidgets.QWidget()
        # self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 1112, 932))
        #
        # self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        # layout = QtWidgets.QHBoxLayout(self.scrollAreaWidgetContents)
        #
        # Homewindow.setCentralWidget(self.centralwidget)




        self.tf2 = QtWidgets.QLineEdit(self.centralwidget)
        self.tf2.setEnabled(False)
        self.tf2.setGeometry(QtCore.QRect(300, 290, 71, 31))
        self.tf2.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tf2.setObjectName("tf2")
        self.tf3 = QtWidgets.QLineEdit(self.centralwidget)
        self.tf3.setEnabled(False)
        self.tf3.setGeometry(QtCore.QRect(300, 410, 71, 31))
        self.tf3.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tf3.setObjectName("tf3")
        self.tf4 = QtWidgets.QLineEdit(self.centralwidget)
        self.tf4.setEnabled(False)
        self.tf4.setGeometry(QtCore.QRect(300, 540, 71, 31))
        self.tf4.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tf4.setObjectName("tf4")
        self.foodframe = QtWidgets.QFrame(self.centralwidget)
        self.foodframe.setGeometry(QtCore.QRect(70, 140, 311, 681))
        self.foodframe.setStyleSheet(".QFrame{\n"
"border-radius: 10px;\n"
"border: 3px solid #4DD0E1;\n"
"    border-color: rgb(255, 255, 0);\n"
"}")
        self.foodframe.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.foodframe.setFrameShadow(QtWidgets.QFrame.Plain)
        self.foodframe.setLineWidth(8)
        self.foodframe.setMidLineWidth(8)
        self.foodframe.setObjectName("foodframe")
        self.cf1 = QtWidgets.QCheckBox(self.foodframe)
        self.cf1.setGeometry(QtCore.QRect(10, 10, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cf1.setFont(font)
        self.cf1.setStyleSheet("color: rgb(255, 255, 255);")
        self.cf1.setObjectName("cf1")

        ###########################ACTION################
        self.cf1.stateChanged.connect(lambda: self.cf1_function(self.cf1, self.tf1))
        ################################################

        self.cf2 = QtWidgets.QCheckBox(self.foodframe)
        self.cf2.setGeometry(QtCore.QRect(10, 150, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cf2.setFont(font)
        self.cf2.setStyleSheet("color: rgb(255, 255, 255);")
        self.cf2.setObjectName("cf2")
        ###########################ACTION################
        self.cf2.stateChanged.connect(lambda: self.cf2_function(self.cf2, self.tf2))
        ################################################

        self.cf3 = QtWidgets.QCheckBox(self.foodframe)
        self.cf3.setGeometry(QtCore.QRect(10, 270, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cf3.setFont(font)
        self.cf3.setStyleSheet("color: rgb(255, 255, 255);")
        self.cf3.setObjectName("cf3")

        ###########################ACTION################
        self.cf3.stateChanged.connect(lambda: self.cf3_function(self.cf3, self.tf3))
        ################################################

        self.cf4 = QtWidgets.QCheckBox(self.foodframe)
        self.cf4.setGeometry(QtCore.QRect(10, 400, 151, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cf4.setFont(font)
        self.cf4.setAutoFillBackground(False)
        self.cf4.setStyleSheet("color: rgb(255, 255, 255);")
        self.cf4.setObjectName("cf4")

        ###########################ACTION################
        self.cf4.stateChanged.connect(lambda: self.cf4_function(self.cf4, self.tf4))
        ################################################

        self.tf1 = QtWidgets.QLineEdit(self.foodframe)
        self.tf1.setEnabled(False)
        self.tf1.setGeometry(QtCore.QRect(230, 10, 71, 31))
        self.tf1.setStyleSheet("QLineEdit{\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"border-radius: 25px;\n"
"}")
        self.tf1.setObjectName("tf1")
        self.label = QtWidgets.QLabel(self.foodframe)
        self.label.setEnabled(False)
        self.label.setGeometry(QtCore.QRect(20, 180, 271, 81))
        self.label.setWordWrap(True)
        self.label.setObjectName("label")
        self.label_3 = QtWidgets.QLabel(self.foodframe)
        self.label_3.setEnabled(False)
        self.label_3.setGeometry(QtCore.QRect(20, 50, 271, 81))
        self.label_3.setWordWrap(True)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.foodframe)
        self.label_4.setEnabled(False)
        self.label_4.setGeometry(QtCore.QRect(20, 300, 271, 81))
        self.label_4.setWordWrap(True)
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(self.foodframe)
        self.label_5.setEnabled(False)
        self.label_5.setGeometry(QtCore.QRect(20, 440, 271, 81))
        self.label_5.setWordWrap(True)
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(self.foodframe)
        self.label_6.setEnabled(False)
        self.label_6.setGeometry(QtCore.QRect(20, 580, 271, 81))
        self.label_6.setWordWrap(True)
        self.label_6.setObjectName("label_6")
        self.cp1 = QtWidgets.QCheckBox(self.foodframe)
        self.cp1.setGeometry(QtCore.QRect(10, 550, 151, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cp1.setFont(font)
        self.cp1.setStyleSheet("color: rgb(255, 255, 255);")
        self.cp1.setObjectName("cp1")

        ###########################ACTION################
        self.cp1.stateChanged.connect(lambda: self.cp1_function(self.cp1, self.tp1))
        ################################################

        self.td4 = QtWidgets.QLineEdit(self.centralwidget)
        self.td4.setEnabled(False)
        self.td4.setGeometry(QtCore.QRect(650, 560, 71, 31))
        self.td4.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.td4.setObjectName("td4")
        self.td2 = QtWidgets.QLineEdit(self.centralwidget)
        self.td2.setEnabled(False)
        self.td2.setGeometry(QtCore.QRect(650, 270, 71, 31))
        self.td2.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.td2.setObjectName("td2")
        self.foodframe_2 = QtWidgets.QFrame(self.centralwidget)
        self.foodframe_2.setGeometry(QtCore.QRect(420, 140, 311, 681))
        self.foodframe_2.setStyleSheet(".QFrame{\n"
"border-radius: 10px;\n"
"border: 3px solid #4DD0E1;\n"
"border-color: rgb(255, 255, 0);\n"
"}")
        self.foodframe_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.foodframe_2.setFrameShadow(QtWidgets.QFrame.Plain)
        self.foodframe_2.setLineWidth(8)
        self.foodframe_2.setMidLineWidth(8)
        self.foodframe_2.setObjectName("foodframe_2")
        self.cd1 = QtWidgets.QCheckBox(self.foodframe_2)
        self.cd1.setGeometry(QtCore.QRect(10, 10, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cd1.setFont(font)
        self.cd1.setStyleSheet("color: rgb(255, 255, 255);")
        self.cd1.setObjectName("cd1")

        ###########################ACTION################
        self.cd1.stateChanged.connect(lambda: self.cd1_function(self.cd1, self.td1))
        ################################################

        self.cd2 = QtWidgets.QCheckBox(self.foodframe_2)
        self.cd2.setGeometry(QtCore.QRect(10, 130, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cd2.setFont(font)
        self.cd2.setStyleSheet("color: rgb(255, 255, 255);")
        self.cd2.setObjectName("cd2")

        ###########################ACTION################
        self.cd2.stateChanged.connect(lambda: self.cd2_function(self.cd2, self.td2))
        ################################################

        self.cd4 = QtWidgets.QCheckBox(self.foodframe_2)
        self.cd4.setGeometry(QtCore.QRect(10, 420, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cd4.setFont(font)
        self.cd4.setStyleSheet("color: rgb(255, 255, 255);")
        self.cd4.setObjectName("cd4")

        ###########################ACTION################
        self.cd4.stateChanged.connect(lambda: self.cd4_function(self.cd4, self.td4))
        ################################################

        self.td1 = QtWidgets.QLineEdit(self.foodframe_2)
        self.td1.setEnabled(False)
        self.td1.setGeometry(QtCore.QRect(230, 10, 71, 31))
        self.td1.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.td1.setObjectName("td1")
        self.label_7 = QtWidgets.QLabel(self.foodframe_2)
        self.label_7.setEnabled(False)
        self.label_7.setGeometry(QtCore.QRect(20, 40, 271, 81))
        self.label_7.setWordWrap(True)
        self.label_7.setObjectName("label_7")
        self.label_8 = QtWidgets.QLabel(self.foodframe_2)
        self.label_8.setEnabled(False)
        self.label_8.setGeometry(QtCore.QRect(20, 170, 271, 81))
        self.label_8.setWordWrap(True)
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.foodframe_2)
        self.label_9.setEnabled(False)
        self.label_9.setGeometry(QtCore.QRect(20, 300, 271, 81))
        self.label_9.setWordWrap(True)
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.foodframe_2)
        self.label_10.setEnabled(False)
        self.label_10.setGeometry(QtCore.QRect(20, 450, 271, 81))
        self.label_10.setWordWrap(True)
        self.label_10.setObjectName("label_10")
        self.label_11 = QtWidgets.QLabel(self.foodframe_2)
        self.label_11.setEnabled(False)
        self.label_11.setGeometry(QtCore.QRect(20, 580, 271, 81))
        self.label_11.setWordWrap(True)
        self.label_11.setObjectName("label_11")
        self.td3 = QtWidgets.QLineEdit(self.centralwidget)
        self.td3.setEnabled(False)
        self.td3.setGeometry(QtCore.QRect(650, 410, 71, 31))
        self.td3.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.td3.setObjectName("td3")
        self.tp1 = QtWidgets.QLineEdit(self.centralwidget)
        self.tp1.setEnabled(False)
        self.tp1.setGeometry(QtCore.QRect(300, 680, 71, 31))
        self.tp1.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tp1.setObjectName("tp1")
        self.tc2 = QtWidgets.QLineEdit(self.centralwidget)
        self.tc2.setEnabled(False)
        self.tc2.setGeometry(QtCore.QRect(990, 300, 71, 31))
        self.tc2.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tc2.setObjectName("tc2")
        self.tc4 = QtWidgets.QLineEdit(self.centralwidget)
        self.tc4.setEnabled(False)
        self.tc4.setGeometry(QtCore.QRect(990, 610, 71, 31))
        self.tc4.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tc4.setObjectName("tc4")
        self.foodframe_4 = QtWidgets.QFrame(self.centralwidget)
        self.foodframe_4.setGeometry(QtCore.QRect(770, 140, 301, 611))
        self.foodframe_4.setStyleSheet(".QFrame{\n"
"border-radius: 10px;\n"
"border: 3px solid #4DD0E1;\n"
"    border-color: rgb(255, 255, 0);\n"
"}")
        self.foodframe_4.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.foodframe_4.setFrameShadow(QtWidgets.QFrame.Plain)
        self.foodframe_4.setLineWidth(8)
        self.foodframe_4.setMidLineWidth(8)
        self.foodframe_4.setObjectName("foodframe_4")
        self.cde1 = QtWidgets.QCheckBox(self.foodframe_4)
        self.cde1.setGeometry(QtCore.QRect(10, 10, 151, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cde1.setFont(font)
        self.cde1.setStyleSheet("color: rgb(255, 255, 255);")
        self.cde1.setObjectName("cde1")

        ###########################ACTION################
        self.cde1.stateChanged.connect(lambda: self.cde1_function(self.cde1, self.tc1))
        ################################################

        self.cde2 = QtWidgets.QCheckBox(self.foodframe_4)
        self.cde2.setGeometry(QtCore.QRect(10, 160, 151, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cde2.setFont(font)
        self.cde2.setStyleSheet("color: rgb(255, 255, 255);")
        self.cde2.setObjectName("cde2")

        ###########################ACTION################
        self.cde2.stateChanged.connect(lambda: self.cde2_function(self.cde2, self.tc2))
        ################################################

        self.cde3 = QtWidgets.QCheckBox(self.foodframe_4)
        self.cde3.setGeometry(QtCore.QRect(10, 330, 151, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cde3.setFont(font)
        self.cde3.setStyleSheet("color: rgb(255, 255, 255);")
        self.cde3.setObjectName("cde3")
        ###########################ACTION################
        self.cde3.stateChanged.connect(lambda: self.cde3_function(self.cde3, self.tc3))
        ################################################

        self.cde4 = QtWidgets.QCheckBox(self.foodframe_4)
        self.cde4.setGeometry(QtCore.QRect(10, 470, 151, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cde4.setFont(font)
        self.cde4.setStyleSheet("color: rgb(255, 255, 255);")
        self.cde4.setObjectName("cde4")
        ###########################ACTION################
        self.cde4.stateChanged.connect(lambda: self.cde4_function(self.cde4, self.tc4))
        ################################################
        self.tc1 = QtWidgets.QLineEdit(self.foodframe_4)
        self.tc1.setEnabled(False)
        self.tc1.setGeometry(QtCore.QRect(220, 10, 71, 31))
        self.tc1.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tc1.setObjectName("tc1")
        self.label_12 = QtWidgets.QLabel(self.foodframe_4)
        self.label_12.setEnabled(False)
        self.label_12.setGeometry(QtCore.QRect(20, 50, 271, 81))
        self.label_12.setWordWrap(True)
        self.label_12.setObjectName("label_12")
        self.label_13 = QtWidgets.QLabel(self.foodframe_4)
        self.label_13.setEnabled(False)
        self.label_13.setGeometry(QtCore.QRect(20, 200, 271, 101))
        self.label_13.setWordWrap(True)
        self.label_13.setObjectName("label_13")
        self.label_14 = QtWidgets.QLabel(self.foodframe_4)
        self.label_14.setEnabled(False)
        self.label_14.setGeometry(QtCore.QRect(20, 370, 271, 81))
        self.label_14.setWordWrap(True)
        self.label_14.setObjectName("label_14")
        self.label_15 = QtWidgets.QLabel(self.foodframe_4)
        self.label_15.setEnabled(False)
        self.label_15.setGeometry(QtCore.QRect(20, 510, 271, 81))
        self.label_15.setWordWrap(True)
        self.label_15.setObjectName("label_15")
        self.tc3 = QtWidgets.QLineEdit(self.centralwidget)
        self.tc3.setEnabled(False)
        self.tc3.setGeometry(QtCore.QRect(990, 470, 71, 31))
        self.tc3.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.tc3.setObjectName("tc3")
        self.ts1 = QtWidgets.QLineEdit(self.centralwidget)
        self.ts1.setEnabled(False)
        self.ts1.setGeometry(QtCore.QRect(650, 690, 71, 31))
        self.ts1.setStyleSheet("QLineEdit{\n"
"border-radius : 30px;\n"
"border:3px solid #4DD0E1;\n"
"font: 14px gray;\n"
"padding-left: 5px;\n"
"}")
        self.ts1.setObjectName("ts1")
        self.receipt = QtWidgets.QPushButton(self.centralwidget)
        self.receipt.setGeometry(QtCore.QRect(80, 830, 281, 51))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(False)
        font.setWeight(50)
        self.receipt.setFont(font)
        self.receipt.setStyleSheet("QPushButton{\n"
"background-color: white;\n"
"border-style:outset;\n"
"border-width: 2px;\n"
"border-color:gray;\n"
"border-radius: 25px;\n"
"}\n"
"\n"
"QPushButton:hover{\n"
"background-color: #EEEEEE;\n"
"border-style:inset;\n"
"color: #0097A7;\n"
"\n"
"}")
        ###################################################################################

        self.tf1.setText("0")

        self.tf2.setText("0")

        self.tf3.setText("0")

        self.tf4.setText("0")

        self.td1.setText("0")

        self.td2.setText("0")
        self.td3.setText("0")
        self.td4.setText("0")

        self.tp1.setText("0")

        self.tc1.setText("0")

        self.tc2.setText("0")
        self.tc3.setText("0")
        self.tc4.setText("0")
        self.ts1.setText("0")


        # self.ts4.setText("0")
        ####################################################################################

        self.receipt.setObjectName("receipt")
        # self.receipt.clicked.connect(self.database)


        ####Action####
        self.receipt.clicked.connect(self.view_receipt)
        ##############

        self.total = QtWidgets.QPushButton(self.centralwidget)
        self.total.setGeometry(QtCore.QRect(780, 770, 281, 51))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(False)
        font.setWeight(50)
        self.total.setFont(font)
        self.total.setStyleSheet("QPushButton{\n"
"background-color: white;\n"
"border-style:outset;\n"
"border-width: 2px;\n"
"border-color:gray;\n"
"border-radius: 25px;\n"
"}\n"
"\n"
"QPushButton:hover{\n"
"background-color: #EEEEEE;\n"
"border-style:inset;\n"
"color: #0097A7;\n"
"\n"
"}")

        self.total.setObjectName("total")

        ####Action####
        self.total.clicked.connect(self.total_amount)
        ##############

        self.reset = QtWidgets.QPushButton(self.centralwidget)
        self.reset.setGeometry(QtCore.QRect(440, 830, 281, 51))
        font = QtGui.QFont()
        font.setPointSize(16)
        font.setBold(False)
        font.setWeight(50)
        self.reset.setFont(font)
        self.reset.setStyleSheet("QPushButton{\n"
"background-color: white;\n"
"border-style:outset;\n"
"border-width: 2px;\n"
"border-color:gray;\n"
"border-radius: 25px;\n"
"}\n"
"\n"
"QPushButton:hover{\n"
"background-color: #EEEEEE;\n"
"border-style:inset;\n"
"color: #0097A7;\n"
"\n"
"}")
        self.reset.setObjectName("reset")
        ####Action####
        self.reset.clicked.connect(self.reset_button)
        ##############
        self.totla_pay = QtWidgets.QLineEdit(self.centralwidget)
        self.totla_pay.setGeometry(QtCore.QRect(780, 830, 281, 51))
        font = QtGui.QFont()
        font.setFamily("red")
        font.setPointSize(-1)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.totla_pay.setFont(font)
        self.totla_pay.setStyleSheet("QLineEdit{\n"
"border-radius : 25px;\n"
"border:3px solid #4DD0E1;\n"
"    border-color: rgb(255, 255, 0);\n"
"font: 15px red ;\n"
"padding-left: 10px;\n"
"}")
        self.totla_pay.setObjectName("totla_pay")
        self.cd3 = QtWidgets.QCheckBox(self.centralwidget)
        self.cd3.setGeometry(QtCore.QRect(430, 410, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cd3.setFont(font)
        self.cd3.setStyleSheet("color: rgb(255, 255, 255);")
        self.cd3.setObjectName("cd3")
        ###########################ACTION################
        self.cd3.stateChanged.connect(lambda: self.cd3_function(self.cd3, self.td3))
        ################################################
        self.cs1 = QtWidgets.QCheckBox(self.centralwidget)
        self.cs1.setGeometry(QtCore.QRect(430, 690, 151, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.cs1.setFont(font)
        self.cs1.setStyleSheet("color: rgb(255, 255, 255);")
        self.cs1.setObjectName("cs1")

        ###########################ACTION################
        self.cs1.stateChanged.connect(lambda: self.cs1_function(self.cs1, self.ts1))
        ################################################

        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(0, 0, 1141, 911))
        self.label_2.setText("")
        self.label_2.setPixmap(QtGui.QPixmap("images/Menu.png"))
        self.label_2.setScaledContents(True)
        self.label_2.setObjectName("label_2")
        self.layoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QtCore.QRect(0, 0, 2, 2))
        self.layoutWidget.setObjectName("layoutWidget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.layoutWidget.raise_()
        self.label_2.raise_()
        self.foodframe_4.raise_()
        self.foodframe_2.raise_()
        self.foodframe.raise_()
        self.tf2.raise_()
        self.tf3.raise_()
        self.tf4.raise_()
        self.td4.raise_()
        self.td2.raise_()
        self.td3.raise_()
        self.tp1.raise_()
        self.tc2.raise_()
        self.tc4.raise_()
        self.tc3.raise_()
        self.ts1.raise_()
        self.receipt.raise_()
        self.total.raise_()
        self.reset.raise_()
        self.totla_pay.raise_()
        self.cd3.raise_()
        self.cs1.raise_()
        Homewindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(Homewindow)
        QtCore.QMetaObject.connectSlotsByName(Homewindow)

    def database(self):
        self.view_receipt()
        number = random.randint(1000, 9999)
        Boolani = self.cf1.text()
        Qabuli = self.cf2.text()
        Mantu = self.cf3.text()
        Chicken_Karahi = self.cf4.text()
        Chicken_Fajita = self.cp1.text()
        Soda = self.cd1.text()
        Pepsi = self.cd2.text()
        Sprite = self.cd3.text()
        CocaCola = self.cd4.text()
        Fruity_Pebble = self.cs1.text()
        ChocolateCake = self.cde1.text()
        KeyLimePie = self.cde2.text()
        Brownie = self.cde3.text()
        CheeseCake = self.cde4.text()
        total = self.total.text()
        Taxes_deduction = total - (total * 0.06)

        con = sqlite3.connect("data.db")
        mydb = con.cursor()
        mydb.execute(
            """insert into dash(Number, Boolani, Qabuli, Mantu, ChikenKarahi, ChikenFajita, Soda,Pepsi, Sprite, CocaCola, FruityPebble, ChocolateCake,KeyLimePie, Brownie, CheeseCake, Total, NetProfit   ) values(?, ?, ? ,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",(number,Boolani,Qabuli,Mantu,Chicken_Karahi,Chicken_Fajita,Soda,Pepsi,Sprite,CocaCola,Fruity_Pebble,ChocolateCake,KeyLimePie,Brownie,CheeseCake,total,Taxes_deduction))
        con.commit()

    def retranslateUi(self, Homewindow):
        _translate = QtCore.QCoreApplication.translate
        Homewindow.setWindowTitle(_translate("Homewindow", "MainWindow"))
        self.tf2.setPlaceholderText(_translate("Homewindow", "0"))
        self.tf3.setPlaceholderText(_translate("Homewindow", "0"))
        self.tf4.setPlaceholderText(_translate("Homewindow", "0"))
        self.cf1.setText(_translate("Homewindow", "Boolani"))
        self.cf2.setText(_translate("Homewindow", "Qabuli"))
        self.cf3.setText(_translate("Homewindow", "Mantu"))
        self.cf4.setText(_translate("Homewindow", "Chicken Karahi"))
        self.tf1.setPlaceholderText(_translate("Homewindow", "0"))
        self.label.setText(_translate("Homewindow", "<html><head/><body><p>Kabuli palaw or Qabuli pulao is a variety of pilaf made in Afghanistan, Tajikistan and parts of Central Asian countries. It consists of steamed rice mixed with raisins, carrots, and beef or lamb.</p><p>Price: 300 Afs</p></body></html>"))
        self.label_3.setText(_translate("Homewindow", "<html><head/><body><p>Bolani is a traditional Afghani flatbread stuffed and baked with either spinach, pumpkin, red potato, or green lentil filling. Bolani is usually served warm and as a side-dish, appetizer, or even as a main dish.</p><p>Price: 120 Afs</p></body></html>"))
        self.label_4.setText(_translate("Homewindow", "<html><head/><body><p>Mantu, with their wonton wrappers, spiced meat filling, and seasoned yogurt sauce, deliciously demonstrate how different food cultures can beautifully combine into heavenly dishes..</p><p>Price: 350 Afs</p></body></html>"))
        self.label_5.setText(_translate("Homewindow", "<html><head/><body><p>Chicken karahi, or kadai chicken, is a dish from the Indian subcontinent noted for its spicy taste; it is notable in Pakistani cuisine</p><p>Price: 280 Afs</p></body></html>"))
        self.label_6.setText(_translate("Homewindow", "<html><head/><body><p>Chicken fajitas are an easy and flavorful weeknight meal. A classic Mexican recipe, juicy chicken is seasoned, seared and cooked to perfection</p><p>Price: 550 Afs</p></body></html>"))
        self.cp1.setText(_translate("Homewindow", "Chicken Fajita"))
        self.td4.setPlaceholderText(_translate("Homewindow", "0"))
        self.td2.setPlaceholderText(_translate("Homewindow", "0"))
        self.cd1.setText(_translate("Homewindow", "Soda"))
        self.cd2.setText(_translate("Homewindow", "Pepsi"))
        self.cd4.setText(_translate("Homewindow", "Coca Cola"))
        self.td1.setPlaceholderText(_translate("Homewindow", "0"))
        self.label_7.setText(_translate("Homewindow", "<html><head/><body><p>Carbonated water (originally made with sodium bicarbonate) drunk alone or mixed with alcoholic drinks or fruit juice.</p><p>Price: 100 Afs</p></body></html>"))
        self.label_8.setText(_translate("Homewindow", "<html><head/><body><p>Rivalry with Coca-Cola — Pepsi is a carbonated soft drink manufactured by PepsiCo. Originally created and developed in 1893 by Caleb Bradham</p><p>Price: 80 Afs</p></body></html>"))
        self.label_9.setText(_translate("Homewindow", "<html><head/><body><p>Sprite is a lemon-lime flavored soft drink with a crisp, clean taste that gives you the ultimate cut-through refreshment. Sprite is a lemon-lime flavored soft drink.</p><p>Price: 50 Afs</p></body></html>"))
        self.label_10.setText(_translate("Homewindow", "<html><head/><body><p>Coca-Cola is pairing up with celebrity chefs, talented athletes and more surprise guests all summer long to bring you and your loved ones together over.</p><p>Price: 60 Afs</p></body></html>"))
        self.label_11.setText(_translate("Homewindow", "<html><head/><body><p>Strawberry daiquiri mixer, orange juice, lemon-lime soda, and vodka come together into a cocktail that tastes just like Fruity Pebbles.</p><p>Price: 250 Afs</p></body></html>"))
        self.td3.setPlaceholderText(_translate("Homewindow", "0"))
        self.tp1.setPlaceholderText(_translate("Homewindow", "0"))
        self.tc2.setPlaceholderText(_translate("Homewindow", "0"))
        self.tc4.setPlaceholderText(_translate("Homewindow", "0"))
        self.cde1.setText(_translate("Homewindow", "Chocolate Cake"))
        self.cde2.setText(_translate("Homewindow", "Key Lime Pie"))
        self.cde3.setText(_translate("Homewindow", "Brownie"))
        self.cde4.setText(_translate("Homewindow", "Cheese Cake"))
        self.tc1.setPlaceholderText(_translate("Homewindow", "0"))
        self.label_12.setText(_translate("Homewindow", "<html><head/><body><p>Chocolate cake or chocolate gâteau is a cake flavored with melted chocolate, cocoa powder, or both.</p><p>Price: 300 Afs</p></body></html>"))
        self.label_13.setText(_translate("Homewindow", "<html><head/><body><p>Key lime pie is an American dessert pie made of Key lime juice, egg yolks, and sweetened condensed milk. It may be served with no topping, topped with a meringue topping made from the egg whites, or with whipped cream.</p><p>Price: 320 Afs</p></body></html>"))
        self.label_14.setText(_translate("Homewindow", "<html><head/><body><p>A chocolate brownie or simply a brownie is a square or rectangular chocolate baked confection. Brownies come in a variety of forms and may be either fudgy or cakey, depending on their density.</p><p>Price: 180 Afs</p></body></html>"))
        self.label_15.setText(_translate("Homewindow", "<html><head/><body><p>Cheesecake is a sweet dessert consisting of one or more layers. The main, and thickest, layer consists of a mixture of a soft, fresh cheese, eggs, and sugar.</p><p>Price: 190 Afs</p></body></html>"))
        self.tc3.setPlaceholderText(_translate("Homewindow", "0"))
        self.ts1.setPlaceholderText(_translate("Homewindow", "0"))
        self.receipt.setText(_translate("Homewindow", "Generate Receipt"))
        self.total.setText(_translate("Homewindow", "Total"))
        self.reset.setText(_translate("Homewindow", "Reset"))
        self.totla_pay.setPlaceholderText(_translate("Homewindow", "0"))
        self.cd3.setText(_translate("Homewindow", "Sprite"))
        self.cs1.setText(_translate("Homewindow", "Fruity Pebble"))




if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Homewindow = QtWidgets.QMainWindow()
    ui = usernaem(Homewindow)
    ui.setupUi(Homewindow)
    Homewindow.show()
    sys.exit(app.exec_())
