def detail_pay_return_in_payment_mode(self, pay_list): buf = '' for info in pay_list: for i in range(len(info)): if i == 0: buf += ' ' * 9 + str(info[i]) elif i == 1: buf += ' ' * 17 + str(info[i]) elif i == 2: if info[i] == '상품권': buf += ' ' * 11 + str(info[i]) else: buf += ' ' * 13 + str(info[i]) elif i == 3: if info[2] == '현금': buf += ' ' * 20 + '-' + ' ' * 13 elif info[2] == '카드': buf += ' ' * 12 + str(info[i]) + ' ' * 6 else: buf += ' ' * 10 + str(info[i]) + ' ' * 4 else: common_function = Common_function() buf += str(common_function.insert_comma(info[i])) buf += '\n' return buf
def setupUi(self, Dialog, main_mode): import count_modification_rc Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(890, 439) self.common_function = Common_function() self.__check = False self.__target = True #숫자 버튼을 쓸 곳 구분을 위함 // Ture : 번호 칸 , False : 수량 칸 self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.bg = QtWidgets.QLabel(self.centralwidget) self.bg.setGeometry(QtCore.QRect(2, 0, 888, 440)) self.bg.setStyleSheet( "border-image: url(:/newPrefix/cntmodification.png);") self.bg.setPixmap(QtGui.QPixmap(":/image/image/cntmodification.png")) self.bg.setObjectName("bg") #완료 버튼 self.ok = QtWidgets.QPushButton(self.centralwidget) self.ok.setGeometry(QtCore.QRect(730, 320, 126, 85)) self.ok.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.ok.setObjectName("ok") self.ok.clicked.connect(self.ok_clicked) #지우기 버튼 self.my_del = QtWidgets.QPushButton(self.centralwidget) self.my_del.setGeometry(QtCore.QRect(467, 320, 126, 85)) self.my_del.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.my_del.setObjectName("my_del") self.my_del.clicked.connect(self.my_del_clicked) #번호 버튼 self.num = QtWidgets.QPushButton(self.centralwidget) self.num.setGeometry(QtCore.QRect(330, 140, 111, 61)) self.num.setStyleSheet("border-image: url(:/newPrefix/4.png);\n" "font: 24pt \"Arial\";") self.num.setObjectName("num") self.num.setText("") self.num.clicked.connect(self.num_clicked) #수량 버튼 self.cnt = QtWidgets.QPushButton(self.centralwidget) self.cnt.setGeometry(QtCore.QRect(330, 240, 111, 61)) self.cnt.setStyleSheet("border-image: url(:/newPrefix/4.png);\n" "font: 24pt \"Arial\";") self.cnt.setObjectName("cnt") self.cnt.setText("") self.cnt.clicked.connect(self.cnt_clicked) #숫자 버튼들 self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(467, 131, 126, 85)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(730, 37, 126, 85)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(599, 320, 126, 85)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(467, 37, 126, 85)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(599, 225, 126, 85)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(467, 225, 126, 85)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(599, 131, 126, 85)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(730, 131, 126, 85)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(730, 225, 126, 85)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(599, 37, 126, 85)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked)
def setupUi(self, Dialog): import pay_rc #Window 설정 Dialog.setObjectName("Dialog") Dialog.resize(1003, 633) self.__num_buf = '' #카드 번호 버퍼 self.common_function = Common_function() self.__check = False self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.bg = QtWidgets.QLabel(self.centralwidget) self.bg.setGeometry(QtCore.QRect(1, -10, 1011, 651)) self.bg.setStyleSheet("border-image: url(image/mh2.PNG);") self.bg.setScaledContents(True) self.bg.setObjectName("bg") # 카드 번호 입력 칸 self.card_num1 = QtWidgets.QLineEdit(self.centralwidget) self.card_num1.setGeometry(QtCore.QRect(78, 290, 121, 61)) self.card_num1.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num1.setObjectName("card_num1") self.card_num2 = QtWidgets.QLineEdit(self.centralwidget) self.card_num2.setGeometry(QtCore.QRect(198, 290, 121, 61)) self.card_num2.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num2.setObjectName("card_num2") self.card_num3 = QtWidgets.QLineEdit(self.centralwidget) self.card_num3.setGeometry(QtCore.QRect(320, 290, 121, 61)) self.card_num3.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num3.setObjectName("card_num3") self.card_num4 = QtWidgets.QLineEdit(self.centralwidget) self.card_num4.setGeometry(QtCore.QRect(442, 290, 121, 61)) self.card_num4.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num4.setObjectName("card_num4") # 숫자 버튼 self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(592, 143, 111, 81)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(716, 141, 121, 81)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(843, 143, 121, 81)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(590, 230, 121, 81)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(590, 316, 121, 81)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b_del = QtWidgets.QPushButton(self.centralwidget) self.b_del.setGeometry(QtCore.QRect(588, 405, 121, 81)) self.b_del.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_del.setObjectName("b_del") self.b_del.clicked.connect(self.b_del_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(717, 405, 121, 81)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) self.b_com = QtWidgets.QPushButton(self.centralwidget) self.b_com.setGeometry(QtCore.QRect(844, 405, 121, 81)) self.b_com.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_com.setObjectName("b_com") self.b_com.clicked.connect(self.b_com_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(718, 317, 121, 81)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(717, 230, 121, 81)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(843, 230, 121, 81)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(843, 318, 121, 81)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked)
class Count_modification(QDialog): def setupUi(self, Dialog, main_mode): import count_modification_rc Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(890, 439) self.common_function = Common_function() self.__check = False self.__target = True #숫자 버튼을 쓸 곳 구분을 위함 // Ture : 번호 칸 , False : 수량 칸 self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.bg = QtWidgets.QLabel(self.centralwidget) self.bg.setGeometry(QtCore.QRect(2, 0, 888, 440)) self.bg.setStyleSheet( "border-image: url(:/newPrefix/cntmodification.png);") self.bg.setPixmap(QtGui.QPixmap(":/image/image/cntmodification.png")) self.bg.setObjectName("bg") #완료 버튼 self.ok = QtWidgets.QPushButton(self.centralwidget) self.ok.setGeometry(QtCore.QRect(730, 320, 126, 85)) self.ok.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.ok.setObjectName("ok") self.ok.clicked.connect(self.ok_clicked) #지우기 버튼 self.my_del = QtWidgets.QPushButton(self.centralwidget) self.my_del.setGeometry(QtCore.QRect(467, 320, 126, 85)) self.my_del.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.my_del.setObjectName("my_del") self.my_del.clicked.connect(self.my_del_clicked) #번호 버튼 self.num = QtWidgets.QPushButton(self.centralwidget) self.num.setGeometry(QtCore.QRect(330, 140, 111, 61)) self.num.setStyleSheet("border-image: url(:/newPrefix/4.png);\n" "font: 24pt \"Arial\";") self.num.setObjectName("num") self.num.setText("") self.num.clicked.connect(self.num_clicked) #수량 버튼 self.cnt = QtWidgets.QPushButton(self.centralwidget) self.cnt.setGeometry(QtCore.QRect(330, 240, 111, 61)) self.cnt.setStyleSheet("border-image: url(:/newPrefix/4.png);\n" "font: 24pt \"Arial\";") self.cnt.setObjectName("cnt") self.cnt.setText("") self.cnt.clicked.connect(self.cnt_clicked) #숫자 버튼들 self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(467, 131, 126, 85)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(730, 37, 126, 85)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(599, 320, 126, 85)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(467, 37, 126, 85)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(599, 225, 126, 85)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(467, 225, 126, 85)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(599, 131, 126, 85)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(730, 131, 126, 85)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(730, 225, 126, 85)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(599, 37, 126, 85)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) def ok_clicked(self): ''' 빈칸 유무 체크 후, 파일에 번호와 수량을 기록함 :return: ''' if self.num.text() == '' or self.cnt.text() == '': self.common_function.msg_box('빈칸이 있습니다 ! ') else: num = self.num.text() cnt = self.cnt.text() text = num + ' ' + cnt with open('text/count_modification_buf.txt', 'w', encoding='utf-8') as f: f.write(text) self.common_function.msg_box('입력되었습니다.\n창을 닫으십시오. ') self.__check = True def my_del_clicked(self): ''' self.__target 에 따라 번호 칸이나 수량 칸을 지움 :return: ''' if self.__target: self.num.setText("") else: self.cnt.setText("") def num_clicked(self): ''' 번호 버튼 클릭 이벤트 버튼들의 타겟을 번호 칸으로 변경함 :return: ''' self.__target = True def cnt_clicked(self): ''' 수량 버튼 클릭 이벤트 버튼들의 타겟을 수량 칸으로 변경함 :return: ''' self.__target = False def b0_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "0") else: self.cnt.setText(self.cnt.text() + "0") def b1_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "1") else: self.cnt.setText(self.cnt.text() + "1") def b2_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "2") else: self.cnt.setText(self.cnt.text() + "2") def b3_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "3") else: self.cnt.setText(self.cnt.text() + "3") def b4_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "4") else: self.cnt.setText(self.cnt.text() + "4") def b5_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "5") else: self.cnt.setText(self.cnt.text() + "5") def b6_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "6") else: self.cnt.setText(self.cnt.text() + "6") def b7_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "7") else: self.cnt.setText(self.cnt.text() + "7") def b8_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "8") else: self.cnt.setText(self.cnt.text() + "8") def b9_clicked(self): ''' self.__target에 따라 숫자를 입력함 :return: ''' if self.__target: self.num.setText(self.num.text() + "9") else: self.cnt.setText(self.cnt.text() + "9")
def setupUi(self, Dialog, list_buf): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(1000, 550) self.__num_buf = '' # 카드 번호 버퍼 self.__list_buf = list_buf #결제할 리스트 self.common_function = Common_function() self.set_payment_info = Set_payment_info() self.__check = False self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.bg = QtWidgets.QLabel(self.centralwidget) self.bg.setGeometry(QtCore.QRect(0, 0, 1011, 651)) self.bg.setStyleSheet("border-image: url(image/mh1.PNG);") self.bg.setPixmap(QtGui.QPixmap(":/payment/next_but/mh1.PNG")) self.bg.setScaledContents(True) self.bg.setObjectName("bg") # 카드 번호 입력 칸 self.card_num1 = QtWidgets.QLineEdit(self.centralwidget) self.card_num1.setGeometry(QtCore.QRect(78, 290, 121, 61)) self.card_num1.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num1.setObjectName("card_num1") self.card_num1.setText("") self.card_num2 = QtWidgets.QLineEdit(self.centralwidget) self.card_num2.setGeometry(QtCore.QRect(198, 290, 121, 61)) self.card_num2.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num2.setObjectName("card_num2") self.card_num2.setText("") self.card_num3 = QtWidgets.QLineEdit(self.centralwidget) self.card_num3.setGeometry(QtCore.QRect(320, 290, 121, 61)) self.card_num3.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num3.setObjectName("card_num3") self.card_num3.setText("") self.card_num4 = QtWidgets.QLineEdit(self.centralwidget) self.card_num4.setGeometry(QtCore.QRect(442, 290, 121, 61)) self.card_num4.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num4.setObjectName("card_num4") self.card_num4.setText("") #숫자 버튼 self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(592, 143, 111, 81)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(716, 141, 121, 81)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(843, 143, 121, 81)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(590, 230, 121, 81)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(590, 316, 121, 81)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(717, 405, 121, 81)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(718, 317, 121, 81)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(717, 230, 121, 81)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(843, 230, 121, 81)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(843, 318, 121, 81)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) self.b_del = QtWidgets.QPushButton(self.centralwidget) self.b_del.setGeometry(QtCore.QRect(588, 405, 121, 81)) self.b_del.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_del.setObjectName("b_del") self.b_del.clicked.connect(self.b_del_clicked) self.b_com = QtWidgets.QPushButton(self.centralwidget) self.b_com.setGeometry(QtCore.QRect(844, 405, 121, 81)) self.b_com.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_com.setObjectName("b_com") self.b_com.clicked.connect(self.b_com_clicked)
class Card_cancle(QDialog): def setupUi(self, Dialog): import pay_rc #Window 설정 Dialog.setObjectName("Dialog") Dialog.resize(1003, 633) self.__num_buf = '' #카드 번호 버퍼 self.common_function = Common_function() self.__check = False self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.bg = QtWidgets.QLabel(self.centralwidget) self.bg.setGeometry(QtCore.QRect(1, -10, 1011, 651)) self.bg.setStyleSheet("border-image: url(image/mh2.PNG);") self.bg.setScaledContents(True) self.bg.setObjectName("bg") # 카드 번호 입력 칸 self.card_num1 = QtWidgets.QLineEdit(self.centralwidget) self.card_num1.setGeometry(QtCore.QRect(78, 290, 121, 61)) self.card_num1.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num1.setObjectName("card_num1") self.card_num2 = QtWidgets.QLineEdit(self.centralwidget) self.card_num2.setGeometry(QtCore.QRect(198, 290, 121, 61)) self.card_num2.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num2.setObjectName("card_num2") self.card_num3 = QtWidgets.QLineEdit(self.centralwidget) self.card_num3.setGeometry(QtCore.QRect(320, 290, 121, 61)) self.card_num3.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num3.setObjectName("card_num3") self.card_num4 = QtWidgets.QLineEdit(self.centralwidget) self.card_num4.setGeometry(QtCore.QRect(442, 290, 121, 61)) self.card_num4.setStyleSheet( "border-image: url(:/newPrefix/car_num.png);\n" "font: 28pt \"Arial\";") self.card_num4.setObjectName("card_num4") # 숫자 버튼 self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(592, 143, 111, 81)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(716, 141, 121, 81)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(843, 143, 121, 81)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(590, 230, 121, 81)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(590, 316, 121, 81)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b_del = QtWidgets.QPushButton(self.centralwidget) self.b_del.setGeometry(QtCore.QRect(588, 405, 121, 81)) self.b_del.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_del.setObjectName("b_del") self.b_del.clicked.connect(self.b_del_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(717, 405, 121, 81)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) self.b_com = QtWidgets.QPushButton(self.centralwidget) self.b_com.setGeometry(QtCore.QRect(844, 405, 121, 81)) self.b_com.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_com.setObjectName("b_com") self.b_com.clicked.connect(self.b_com_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(718, 317, 121, 81)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(717, 230, 121, 81)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(843, 230, 121, 81)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(843, 318, 121, 81)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) def b0_clicked(self): self.__num_buf += '0' self.__write_num() def b1_clicked(self): self.__num_buf += '1' self.__write_num() def b2_clicked(self): self.__num_buf += '2' self.__write_num() def b3_clicked(self): self.__num_buf += '3' self.__write_num() def b4_clicked(self): self.__num_buf += '4' self.__write_num() def b5_clicked(self): self.__num_buf += '5' self.__write_num() def b6_clicked(self): self.__num_buf += '6' self.__write_num() def b7_clicked(self): self.__num_buf += '7' self.__write_num() def b8_clicked(self): self.__num_buf += '8' self.__write_num() def b9_clicked(self): self.__num_buf += '9' self.__write_num() def __write_num(self): ''' self.__num_buf의 숫자를 각 칸에 맞게 입력시킴 :return: ''' n = len(self.__num_buf) t = int(n / 4) if t == 0: self.card_num1.setText(self.__num_buf[:n]) elif t == 1: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:n]) elif t == 2: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:8]) self.card_num3.setText(self.__num_buf[8:n]) elif t == 3: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:8]) self.card_num3.setText(self.__num_buf[8:12]) self.card_num4.setText(self.__num_buf[12:n]) else: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:8]) self.card_num3.setText(self.__num_buf[8:12]) self.card_num4.setText(self.__num_buf[12:16]) self.__num_buf = self.__num_buf[:16] def b_del_clicked(self): ''' 입력된 카드번호를 초기화함 :return: ''' self.__num_buf = '' self.card_num1.setText("") self.card_num2.setText("") self.card_num3.setText("") self.card_num4.setText("") def b_com_clicked(self): ''' 16자리가 입력되면 MainWindow로 넘겨주기 위해서 .txt 파일로 기록함 :return: ''' if self.__check: self.common_function.msg_box('이미 완료 되었습니다.\n창을 닫으십시오. ') return if len(self.__num_buf) != 16: self.common_function.msg_box('입력이 올바르지 않습니다. ') return if not self.common_function.check_number(self.__num_buf): return text = self.common_function.text_read('text/card_cancle.txt') if text == '': buf = '1\n' else: text = text.split('\n') buf = str(int(text[0]) + 1) + '\n' buf += self.__num_buf self.common_function.text_write('text/card_cancle.txt', buf) self.common_function.msg_box('입력되었습니다.\n창을 닫으십시오. ') self.__check = True
def setupUi(self, Dialog, list_buf): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(1050, 550) self.common_function = Common_function() self.set_payment_info = Set_payment_info() self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") self.__num_buf = '' self.__list_buf = list_buf self.__check = False #배경 라벨 self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 1071, 681)) self.label.setStyleSheet("background-image: url(image/mh3.PNG);") self.label.setText("") self.label.setScaledContents(True) self.label.setObjectName("label") #카드 번호 입력칸 self.gift_num1 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num1.setGeometry(QtCore.QRect(83, 312, 125, 61)) self.gift_num1.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num1.setObjectName("gift_num1") self.gift_num2 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num2.setGeometry(QtCore.QRect(209, 312, 125, 61)) self.gift_num2.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num2.setObjectName("gift_num2") self.gift_num3 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num3.setGeometry(QtCore.QRect(335, 312, 125, 61)) self.gift_num3.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num3.setObjectName("gift_num3") self.gift_num4 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num4.setGeometry(QtCore.QRect(464, 312, 125, 61)) self.gift_num4.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num4.setObjectName("gift_num4") #숫자 버튼들 self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(615, 150, 130, 93)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setText("") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(615, 245, 130, 93)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setText("") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(616, 338, 130, 93)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(880, 338, 130, 93)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setText("") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(880, 245, 130, 93)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setText("") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(881, 150, 130, 93)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setText("") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(750, 150, 130, 93)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b8.setText("") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(749, 245, 130, 93)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setText("") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(750, 338, 130, 93)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setText("") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(750, 432, 130, 93)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setText("") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) #지우기 버튼 self.b_erase = QtWidgets.QPushButton(self.centralwidget) self.b_erase.setGeometry(QtCore.QRect(615, 432, 130, 93)) self.b_erase.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_erase.setText("") self.b_erase.setObjectName("b_erase") self.b_erase.clicked.connect(self.b_erase_clicked) #완료 버튼 self.b_ok = QtWidgets.QPushButton(self.centralwidget) self.b_ok.setGeometry(QtCore.QRect(881, 432, 130, 93)) self.b_ok.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_ok.setText("") self.b_ok.setObjectName("b_ok") self.b_ok.clicked.connect(self.b_ok_cilcked)
class Card_payment(QDialog): def setupUi(self, Dialog, list_buf): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(1000, 550) self.__num_buf = '' # 카드 번호 버퍼 self.__list_buf = list_buf #결제할 리스트 self.common_function = Common_function() self.set_payment_info = Set_payment_info() self.__check = False self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.bg = QtWidgets.QLabel(self.centralwidget) self.bg.setGeometry(QtCore.QRect(0, 0, 1011, 651)) self.bg.setStyleSheet("border-image: url(image/mh1.PNG);") self.bg.setPixmap(QtGui.QPixmap(":/payment/next_but/mh1.PNG")) self.bg.setScaledContents(True) self.bg.setObjectName("bg") # 카드 번호 입력 칸 self.card_num1 = QtWidgets.QLineEdit(self.centralwidget) self.card_num1.setGeometry(QtCore.QRect(78, 290, 121, 61)) self.card_num1.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num1.setObjectName("card_num1") self.card_num1.setText("") self.card_num2 = QtWidgets.QLineEdit(self.centralwidget) self.card_num2.setGeometry(QtCore.QRect(198, 290, 121, 61)) self.card_num2.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num2.setObjectName("card_num2") self.card_num2.setText("") self.card_num3 = QtWidgets.QLineEdit(self.centralwidget) self.card_num3.setGeometry(QtCore.QRect(320, 290, 121, 61)) self.card_num3.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num3.setObjectName("card_num3") self.card_num3.setText("") self.card_num4 = QtWidgets.QLineEdit(self.centralwidget) self.card_num4.setGeometry(QtCore.QRect(442, 290, 121, 61)) self.card_num4.setStyleSheet("border-image: url(image/card_num.png);\n" "font: 28pt \"Arial\";") self.card_num4.setObjectName("card_num4") self.card_num4.setText("") #숫자 버튼 self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(592, 143, 111, 81)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(716, 141, 121, 81)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(843, 143, 121, 81)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(590, 230, 121, 81)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(590, 316, 121, 81)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(717, 405, 121, 81)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(718, 317, 121, 81)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(717, 230, 121, 81)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(843, 230, 121, 81)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(843, 318, 121, 81)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) self.b_del = QtWidgets.QPushButton(self.centralwidget) self.b_del.setGeometry(QtCore.QRect(588, 405, 121, 81)) self.b_del.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_del.setObjectName("b_del") self.b_del.clicked.connect(self.b_del_clicked) self.b_com = QtWidgets.QPushButton(self.centralwidget) self.b_com.setGeometry(QtCore.QRect(844, 405, 121, 81)) self.b_com.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_com.setObjectName("b_com") self.b_com.clicked.connect(self.b_com_clicked) def b0_clicked(self): self.__num_buf += '0' self.__write_num() def b1_clicked(self): self.__num_buf += '1' self.__write_num() def b2_clicked(self): self.__num_buf += '2' self.__write_num() def b3_clicked(self): self.__num_buf += '3' self.__write_num() def b4_clicked(self): self.__num_buf += '4' self.__write_num() def b5_clicked(self): self.__num_buf += '5' self.__write_num() def b6_clicked(self): self.__num_buf += '6' self.__write_num() def b7_clicked(self): self.__num_buf += '7' self.__write_num() def b8_clicked(self): self.__num_buf += '8' self.__write_num() def b9_clicked(self): self.__num_buf += '9' self.__write_num() def __write_num(self): ''' self.__num_buf의 숫자를 각 칸에 맞게 입력시킴 :return: ''' n = len(self.__num_buf) t = int(n / 4) if t == 0: self.card_num1.setText(self.__num_buf[:n]) elif t == 1: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:n]) elif t == 2: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:8]) self.card_num3.setText(self.__num_buf[8:n]) elif t == 3: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:8]) self.card_num3.setText(self.__num_buf[8:12]) self.card_num4.setText(self.__num_buf[12:n]) else: self.card_num1.setText(self.__num_buf[:4]) self.card_num2.setText(self.__num_buf[4:8]) self.card_num3.setText(self.__num_buf[8:12]) self.card_num4.setText(self.__num_buf[12:16]) self.__num_buf = self.__num_buf[:16] def b_del_clicked(self): ''' 입력된 상품권번호를 초기화함 :return: ''' self.__num_buf = '' self.card_num1.setText("") self.card_num2.setText("") self.card_num3.setText("") self.card_num4.setText("") def __result_print(self): total_money, discount, result, get_money, rest_money = 0, 0, 0, 0, 0 index = 0 for i in self.__list_buf: total_money += int(i[4]) discount += self.common_function.event_processing( self.__list_buf, index) result = total_money - discount index += 1 return result def b_com_clicked(self): ''' 카드번호를 확인하고 조건에 만족하면 결제 내역을 저장하고 영수증 출력 :return: ''' if self.__check: self.common_function.msg_box('이미 완료 되었습니다.\n창을 닫으십시오. ') if not self.common_function.check_number(self.__num_buf): return if len(self.__num_buf) == 16: check = False with open('text/card_check.txt', 'r', encoding='utf-8') as f: if f is not None: buf = f.read() check = True with open('text/card_check.txt', 'w', encoding='utf-8') as f: if check and buf != '': buf = int(buf) + 1 f.write(str(buf)) else: f.write('1') payment_number = self.set_payment_info.set_payment_number() now = self.set_payment_info.read_datetime() method = '카드' method_info = str(self.__num_buf) total_price = self.common_function.result_print(self.__list_buf)[2] self.set_payment_info.send_payment_result(payment_number, now, method, method_info, total_price) self.__list_buf = self.common_function.modify_list_buf( self.__list_buf) self.set_payment_info.send_payment_detail(self.__list_buf, payment_number) stock_manager = Stock_management() for i in self.__list_buf: pro = stock_manager.product_search(i[0]) quan = pro[2] stock_manager.product_quan_modification(i[0], quan - int(i[3])) self.common_function.msg_box('결제가 완료되었습니다.\n창을 닫으십시오. ') self.__check = True # 영수증 출력 pay = Payment_manage() last_receipt_number = int( self.set_payment_info.set_payment_number()) - 1 detail = pay.return_detail(str(last_receipt_number)) now = datetime.now() date = str(now.year) + '-' + str(now.month) + '-' + str( now.day) + ' ' + str(now.hour) + ':' + str( now.minute) + ':' + str(now.second) self.common_function.receipt_print_form(date, detail, last_receipt_number) else: self.common_function.msg_box('유효하지 않는 카드번호입니다. ')
class Giftcard_payment(object): def setupUi(self, Dialog, list_buf): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(1050, 550) self.common_function = Common_function() self.set_payment_info = Set_payment_info() self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") self.__num_buf = '' self.__list_buf = list_buf self.__check = False #배경 라벨 self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 1071, 681)) self.label.setStyleSheet("background-image: url(image/mh3.PNG);") self.label.setText("") self.label.setScaledContents(True) self.label.setObjectName("label") #카드 번호 입력칸 self.gift_num1 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num1.setGeometry(QtCore.QRect(83, 312, 125, 61)) self.gift_num1.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num1.setObjectName("gift_num1") self.gift_num2 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num2.setGeometry(QtCore.QRect(209, 312, 125, 61)) self.gift_num2.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num2.setObjectName("gift_num2") self.gift_num3 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num3.setGeometry(QtCore.QRect(335, 312, 125, 61)) self.gift_num3.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num3.setObjectName("gift_num3") self.gift_num4 = QtWidgets.QLineEdit(self.centralwidget) self.gift_num4.setGeometry(QtCore.QRect(464, 312, 125, 61)) self.gift_num4.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/1313.png);\n" "font: 28pt \"Arial\";") self.gift_num4.setObjectName("gift_num4") #숫자 버튼들 self.b7 = QtWidgets.QPushButton(self.centralwidget) self.b7.setGeometry(QtCore.QRect(615, 150, 130, 93)) self.b7.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b7.setText("") self.b7.setObjectName("b7") self.b7.clicked.connect(self.b7_clicked) self.b4 = QtWidgets.QPushButton(self.centralwidget) self.b4.setGeometry(QtCore.QRect(615, 245, 130, 93)) self.b4.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b4.setText("") self.b4.setObjectName("b4") self.b4.clicked.connect(self.b4_clicked) self.b1 = QtWidgets.QPushButton(self.centralwidget) self.b1.setGeometry(QtCore.QRect(616, 338, 130, 93)) self.b1.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b1.setObjectName("b1") self.b1.clicked.connect(self.b1_clicked) self.b3 = QtWidgets.QPushButton(self.centralwidget) self.b3.setGeometry(QtCore.QRect(880, 338, 130, 93)) self.b3.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b3.setText("") self.b3.setObjectName("b3") self.b3.clicked.connect(self.b3_clicked) self.b6 = QtWidgets.QPushButton(self.centralwidget) self.b6.setGeometry(QtCore.QRect(880, 245, 130, 93)) self.b6.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b6.setText("") self.b6.setObjectName("b6") self.b6.clicked.connect(self.b6_clicked) self.b9 = QtWidgets.QPushButton(self.centralwidget) self.b9.setGeometry(QtCore.QRect(881, 150, 130, 93)) self.b9.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b9.setText("") self.b9.setObjectName("b9") self.b9.clicked.connect(self.b9_clicked) self.b8 = QtWidgets.QPushButton(self.centralwidget) self.b8.setGeometry(QtCore.QRect(750, 150, 130, 93)) self.b8.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b8.setText("") self.b8.setObjectName("b8") self.b8.clicked.connect(self.b8_clicked) self.b5 = QtWidgets.QPushButton(self.centralwidget) self.b5.setGeometry(QtCore.QRect(749, 245, 130, 93)) self.b5.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b5.setText("") self.b5.setObjectName("b5") self.b5.clicked.connect(self.b5_clicked) self.b2 = QtWidgets.QPushButton(self.centralwidget) self.b2.setGeometry(QtCore.QRect(750, 338, 130, 93)) self.b2.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b2.setText("") self.b2.setObjectName("b2") self.b2.clicked.connect(self.b2_clicked) self.b0 = QtWidgets.QPushButton(self.centralwidget) self.b0.setGeometry(QtCore.QRect(750, 432, 130, 93)) self.b0.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b0.setText("") self.b0.setObjectName("b0") self.b0.clicked.connect(self.b0_clicked) #지우기 버튼 self.b_erase = QtWidgets.QPushButton(self.centralwidget) self.b_erase.setGeometry(QtCore.QRect(615, 432, 130, 93)) self.b_erase.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_erase.setText("") self.b_erase.setObjectName("b_erase") self.b_erase.clicked.connect(self.b_erase_clicked) #완료 버튼 self.b_ok = QtWidgets.QPushButton(self.centralwidget) self.b_ok.setGeometry(QtCore.QRect(881, 432, 130, 93)) self.b_ok.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.b_ok.setText("") self.b_ok.setObjectName("b_ok") self.b_ok.clicked.connect(self.b_ok_cilcked) def b0_clicked(self): self.__num_buf += '0' self.__write_num() def b1_clicked(self): self.__num_buf += '1' self.__write_num() def b2_clicked(self): self.__num_buf += '2' self.__write_num() def b3_clicked(self): self.__num_buf += '3' self.__write_num() def b4_clicked(self): self.__num_buf += '4' self.__write_num() def b5_clicked(self): self.__num_buf += '5' self.__write_num() def b6_clicked(self): self.__num_buf += '6' self.__write_num() def b7_clicked(self): self.__num_buf += '7' self.__write_num() def b8_clicked(self): self.__num_buf += '8' self.__write_num() def b9_clicked(self): self.__num_buf += '9' self.__write_num() def __write_num(self): n = len(self.__num_buf) t = int(n / 5) if t == 0: self.gift_num1.setText(self.__num_buf[:n]) elif t == 1: self.gift_num1.setText(self.__num_buf[:5]) self.gift_num2.setText(self.__num_buf[5:n]) elif t == 2: self.gift_num1.setText(self.__num_buf[:5]) self.gift_num2.setText(self.__num_buf[5:10]) self.gift_num3.setText(self.__num_buf[10:n]) elif t == 3: self.gift_num1.setText(self.__num_buf[:5]) self.gift_num2.setText(self.__num_buf[5:10]) self.gift_num3.setText(self.__num_buf[10:15]) self.gift_num4.setText(self.__num_buf[15:n]) else: self.gift_num1.setText(self.__num_buf[:5]) self.gift_num2.setText(self.__num_buf[5:10]) self.gift_num3.setText(self.__num_buf[10:15]) self.gift_num4.setText(self.__num_buf[15:20]) self.__num_buf = self.__num_buf[:20] def b_erase_clicked(self): ''' 초기화면으로 리셋함 :return: ''' self.__num_buf = '' self.gift_num1.setText("") self.gift_num2.setText("") self.gift_num3.setText("") self.gift_num4.setText("") def __result_print(self): total_money, discount, result, get_money, rest_money = 0, 0, 0, 0, 0 index = 0 for i in self.__list_buf: total_money += int(i[4]) discount += self.common_function.event_processing( self.__list_buf, index) result = total_money - discount index += 1 return result def b_ok_cilcked(self): ''' 상품권번호를 확인하고 조건에 만족하면 결제 내역을 저장하고 영수증 출력 :return: ''' if not self.common_function.check_number(self.__num_buf): return if len(self.__num_buf) == 20: check = False with open('text/card_check.txt', 'r', encoding='utf-8') as f: if f is not None: buf = f.read() check = True with open('text/giftcard_check.txt', 'w', encoding='utf-8') as f: if check and buf != '': buf = int(buf) + 1 f.write(str(buf)) else: f.write('1') payment_number = self.set_payment_info.set_payment_number() now = self.set_payment_info.read_datetime() method = '상품권' method_info = str(self.__num_buf) temp = self.common_function.result_print(self.__list_buf) total_price = self.common_function.result_print(self.__list_buf)[2] self.set_payment_info.send_payment_result(payment_number, now, method, method_info, total_price) self.__list_buf = self.common_function.modify_list_buf( self.__list_buf) self.set_payment_info.send_payment_detail(self.__list_buf, payment_number) stock_manager = Stock_management() for i in self.__list_buf: pro = stock_manager.product_search(i[0]) quan = pro[2] stock_manager.product_quan_modification(i[0], quan - int(i[3])) self.common_function.msg_box('결제가 완료되었습니다. ') self.__check = True # 영수증 출력 pay = Payment_manage() last_receipt_number = int( self.set_payment_info.set_payment_number()) - 1 detail = pay.return_detail(str(last_receipt_number)) now = datetime.now() date = str(now.year) + '-' + str(now.month) + '-' + str( now.day) + ' ' + str(now.hour) + ':' + str( now.minute) + ':' + str(now.second) self.common_function.receipt_print_form(date, detail, last_receipt_number) else: self.common_function.msg_box('유효하지 않는 상품권번호입니다. ')
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(887, 971) self.common_function = Common_function() self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 883, 923)) self.label.setText("") self.label.setPixmap(QtGui.QPixmap("image/goods_input.png")) self.label.setScaledContents(True) self.label.setObjectName("label") #지우기 버튼 self.delet = QtWidgets.QPushButton(self.centralwidget) self.delet.setGeometry(QtCore.QRect(200, 800, 126, 85)) self.delet.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";") self.delet.setObjectName("delet") self.delet.clicked.connect(self.delete_clicked) #완료 버튼 self.ok = QtWidgets.QPushButton(self.centralwidget) self.ok.setGeometry(QtCore.QRect(536, 800, 126, 85)) self.ok.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";") self.ok.setObjectName("ok") self.ok.clicked.connect(self.ok_clicked) #바코드 칸 self.lbarcode = QtWidgets.QLineEdit(self.centralwidget) self.lbarcode.setGeometry(QtCore.QRect(324, 188, 466, 60)) self.lbarcode.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lbarcode.setObjectName("lbarcode") #이름 칸 self.lgoodsname = QtWidgets.QLineEdit(self.centralwidget) self.lgoodsname.setGeometry(QtCore.QRect(324, 276, 466, 60)) self.lgoodsname.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodsname.setObjectName("lgoodsname") #단가 칸 self.lgoodsprice = QtWidgets.QLineEdit(self.centralwidget) self.lgoodsprice.setGeometry(QtCore.QRect(324, 365, 466, 60)) self.lgoodsprice.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodsprice.setObjectName("lgoodsprice") #수량 칸 self.lgoodscnt = QtWidgets.QLineEdit(self.centralwidget) self.lgoodscnt.setGeometry(QtCore.QRect(324, 454, 466, 60)) self.lgoodscnt.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodscnt.setObjectName("lgoodscnt") #금액 칸 self.ltotal = QtWidgets.QPushButton(self.centralwidget) self.ltotal.setGeometry(QtCore.QRect(324, 542, 466, 60)) self.ltotal.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.ltotal.setObjectName("ltotal") self.ltotal.clicked.connect(self.ltotal_clicked) self.ltotal.setObjectName("ltotal") #이벤트 칸 self.lgoodsevent = QtWidgets.QLineEdit(self.centralwidget) self.lgoodsevent.setGeometry(QtCore.QRect(324, 631, 466, 60)) self.lgoodsevent.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodsevent.setObjectName("lgoodsevent") #미성년자구분 칸 self.lgoodslimit = QtWidgets.QLineEdit(self.centralwidget) self.lgoodslimit.setGeometry(QtCore.QRect(324, 719, 466, 60)) self.lgoodslimit.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodslimit.setObjectName("lgoodslimit")
class Goods_input(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(887, 971) self.common_function = Common_function() self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 883, 923)) self.label.setText("") self.label.setPixmap(QtGui.QPixmap("image/goods_input.png")) self.label.setScaledContents(True) self.label.setObjectName("label") #지우기 버튼 self.delet = QtWidgets.QPushButton(self.centralwidget) self.delet.setGeometry(QtCore.QRect(200, 800, 126, 85)) self.delet.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";") self.delet.setObjectName("delet") self.delet.clicked.connect(self.delete_clicked) #완료 버튼 self.ok = QtWidgets.QPushButton(self.centralwidget) self.ok.setGeometry(QtCore.QRect(536, 800, 126, 85)) self.ok.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";") self.ok.setObjectName("ok") self.ok.clicked.connect(self.ok_clicked) #바코드 칸 self.lbarcode = QtWidgets.QLineEdit(self.centralwidget) self.lbarcode.setGeometry(QtCore.QRect(324, 188, 466, 60)) self.lbarcode.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lbarcode.setObjectName("lbarcode") #이름 칸 self.lgoodsname = QtWidgets.QLineEdit(self.centralwidget) self.lgoodsname.setGeometry(QtCore.QRect(324, 276, 466, 60)) self.lgoodsname.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodsname.setObjectName("lgoodsname") #단가 칸 self.lgoodsprice = QtWidgets.QLineEdit(self.centralwidget) self.lgoodsprice.setGeometry(QtCore.QRect(324, 365, 466, 60)) self.lgoodsprice.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodsprice.setObjectName("lgoodsprice") #수량 칸 self.lgoodscnt = QtWidgets.QLineEdit(self.centralwidget) self.lgoodscnt.setGeometry(QtCore.QRect(324, 454, 466, 60)) self.lgoodscnt.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodscnt.setObjectName("lgoodscnt") #금액 칸 self.ltotal = QtWidgets.QPushButton(self.centralwidget) self.ltotal.setGeometry(QtCore.QRect(324, 542, 466, 60)) self.ltotal.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.ltotal.setObjectName("ltotal") self.ltotal.clicked.connect(self.ltotal_clicked) self.ltotal.setObjectName("ltotal") #이벤트 칸 self.lgoodsevent = QtWidgets.QLineEdit(self.centralwidget) self.lgoodsevent.setGeometry(QtCore.QRect(324, 631, 466, 60)) self.lgoodsevent.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodsevent.setObjectName("lgoodsevent") #미성년자구분 칸 self.lgoodslimit = QtWidgets.QLineEdit(self.centralwidget) self.lgoodslimit.setGeometry(QtCore.QRect(324, 719, 466, 60)) self.lgoodslimit.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/fr5.png);\n" "font: 28pt \"Arial\";") self.lgoodslimit.setObjectName("lgoodslimit") def ltotal_clicked(self): ''' 단가 x 수량 값을 self.ltotal에 출력함 :return: ''' price = self.lgoodsprice.text() cnt = self.lgoodscnt.text() if price == '' or cnt == '': self.common_function.msg_box('단가와 수량을 입력하시오. ') return text = int(price) * int(cnt) self.ltotal.setText(str(text)) def ok_clicked(self): ''' 입고될 조건들을 체크하고 모두 만족하면 입고함 :return: ''' check = False barcode = self.lbarcode.text() name = self.lgoodsname.text() price = self.lgoodsprice.text() cnt = self.lgoodscnt.text() total = self.ltotal.text() event = self.lgoodsevent.text() limit = self.lgoodslimit.text() stock_manager = Stock_management() stock_list = stock_manager.product_check() for barcode_check in stock_list: if str(barcode_check[0]) == barcode: self.common_function.msg_box('이미 존재하는 바코드입니다. ') return if not self.common_function.check_barcode(barcode): return if not self.common_function.check_name(name): return if not self.common_function.check_price(price): return if self.ltotal.text() == '': self.common_function.msg_box('금액을 클릭하시오. ') return if len(str(barcode)) == 10 and int(cnt) > 0 and int(price) > 0 and ( event == '1+1' or event == '2+1' or event == '') and (limit == '구매가능' or limit == '구매불가'): if limit == '구매가능': limit = 0 else: limit = 1 if event == '': event = 'null' else: event = '"' + event + '"' check = True if check: stock_manager.product_input(barcode, name, cnt, price, event, str(limit)) self.common_function.msg_box('입고되었습니다.\n입고를 완료했으면 창을 닫으십시오. ') else: self.common_function.msg_box( '--------------------------------------------\nInput Error : 입력이 올바르지 않습니다. \n--------------------------------------------\n바코드 : 10자리\n행사 : "1+1" or "2+1" or ""\n미성년자 : "구매가능" or "구매불가"' ) def delete_clicked(self): ''' 초기화면으로 리셋함 :return: ''' self.lbarcode.setText("") self.lgoodsname.setText("") self.lgoodscnt.setText("") self.lgoodsprice.setText("") self.ltotal.setText("") self.lgoodsevent.setText("") self.lgoodslimit.setText("")
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(1400, 726) self.list_print_function = List_print_function() self.common_function = Common_function() self.__year = None self.__month = None self.__day = None self.__mode = None self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 1400, 726)) self.label.setPixmap(QtGui.QPixmap("image/whitesales.png")) self.label.setScaledContents(True) self.label.setObjectName("label") #달력 위젯 self.calendar = QtWidgets.QCalendarWidget(self.centralwidget) self.calendar.setGeometry(QtCore.QRect(23, 23, 951, 411)) self.calendar.setGridVisible(False) self.calendar.setObjectName("calendar") #일별 매출 버튼 self.bday = QtWidgets.QPushButton(self.centralwidget) self.bday.setGeometry(QtCore.QRect(1001, 389, 122, 121)) self.bday.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.bday.setObjectName("bday") #월별 매출 버튼 self.bmonth = QtWidgets.QPushButton(self.centralwidget) self.bmonth.setGeometry(QtCore.QRect(1129, 389, 122, 121)) self.bmonth.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.bmonth.setObjectName("bmonth") #연별 매출 버튼 self.byear = QtWidgets.QPushButton(self.centralwidget) self.byear.setGeometry(QtCore.QRect(1258, 389, 121, 121)) self.byear.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.byear.setObjectName("byear") # 결제 수단별 매출 버튼 self.bsalemethod = QtWidgets.QPushButton(self.centralwidget) self.bsalemethod.setGeometry(QtCore.QRect(1001, 516, 185, 121)) self.bsalemethod.setStyleSheet( "background-color: rgb(255, 255, 255,0);") self.bsalemethod.setObjectName("bsalemethod") # 제품별 매출 버튼 self.bsalegoods = QtWidgets.QPushButton(self.centralwidget) self.bsalegoods.setGeometry(QtCore.QRect(1193, 516, 185, 121)) self.bsalegoods.setStyleSheet( "background-color: rgb(255, 255, 255,0);") self.bsalegoods.setObjectName("bsalegoods") self.bsalegoods.clicked.connect(self.bsalegoods_clicked) self.choosedate = QtWidgets.QLineEdit(self.centralwidget) self.choosedate.setGeometry(QtCore.QRect(1011, 102, 356, 75)) self.choosedate.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/1.png);") self.choosedate.setObjectName("choosedate") # 총 매출 self.allsales = QtWidgets.QLineEdit(self.centralwidget) self.allsales.setGeometry(QtCore.QRect(1011, 240, 357, 131)) self.allsales.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/2.png);") self.allsales.setObjectName("allsales") # 사용종료 버튼 self.boff = QtWidgets.QPushButton(self.centralwidget) self.boff.setGeometry(QtCore.QRect(1000, 643, 380, 61)) self.boff.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.boff.setObjectName("boff") # 결제 수단별 이미지 self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.label_2.setPixmap(QtGui.QPixmap("image/fr7.png")) self.label_2.setScaledContents(True) self.label_2.setObjectName("label_2") self.moneytxt = QtWidgets.QLineEdit(self.centralwidget) self.moneytxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.moneytxt.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/3.png);") self.moneytxt.setObjectName("moneytxt") self.cardtxt = QtWidgets.QLineEdit(self.centralwidget) self.cardtxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.cardtxt.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/3.png);") self.cardtxt.setObjectName("cardtxt") self.gifttxt = QtWidgets.QLineEdit(self.centralwidget) self.gifttxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.gifttxt.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/3.png);") self.gifttxt.setObjectName("gifttxt") # 결제수단별 리스트 출력 하는곳 self.goodslistview = QtWidgets.QTextEdit(self.centralwidget) self.goodslistview.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.goodslistview.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "font: 20pt \"Fixedsys\";" "border-image: url(image/fr6.png);") self.goodslistview.setObjectName("goodslistview") self.sales_list_attribute = QtWidgets.QPushButton(self.centralwidget) self.sales_list_attribute.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.sales_list_attribute.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/sales_list_attribute.png);") self.sales_list_attribute.setObjectName('sales_list_attribute') self.bday.clicked.connect(self.bday_clicked) self.bmonth.clicked.connect(self.bmonth_clicked) self.byear.clicked.connect(self.byear_clicked) self.bsalemethod.clicked.connect(self.bsalemethod_clicked) self.bsalegoods.clicked.connect(self.bsalegoods_clicked) QtCore.QMetaObject.connectSlotsByName(Dialog)
class Sales_check(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowTitle("POS") Dialog.setWindowIcon(QIcon('image/icon.png')) Dialog.resize(1400, 726) self.list_print_function = List_print_function() self.common_function = Common_function() self.__year = None self.__month = None self.__day = None self.__mode = None self.centralwidget = QtWidgets.QWidget(Dialog) self.centralwidget.setObjectName("centralwidget") #배경 라벨 self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 1400, 726)) self.label.setPixmap(QtGui.QPixmap("image/whitesales.png")) self.label.setScaledContents(True) self.label.setObjectName("label") #달력 위젯 self.calendar = QtWidgets.QCalendarWidget(self.centralwidget) self.calendar.setGeometry(QtCore.QRect(23, 23, 951, 411)) self.calendar.setGridVisible(False) self.calendar.setObjectName("calendar") #일별 매출 버튼 self.bday = QtWidgets.QPushButton(self.centralwidget) self.bday.setGeometry(QtCore.QRect(1001, 389, 122, 121)) self.bday.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.bday.setObjectName("bday") #월별 매출 버튼 self.bmonth = QtWidgets.QPushButton(self.centralwidget) self.bmonth.setGeometry(QtCore.QRect(1129, 389, 122, 121)) self.bmonth.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.bmonth.setObjectName("bmonth") #연별 매출 버튼 self.byear = QtWidgets.QPushButton(self.centralwidget) self.byear.setGeometry(QtCore.QRect(1258, 389, 121, 121)) self.byear.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.byear.setObjectName("byear") # 결제 수단별 매출 버튼 self.bsalemethod = QtWidgets.QPushButton(self.centralwidget) self.bsalemethod.setGeometry(QtCore.QRect(1001, 516, 185, 121)) self.bsalemethod.setStyleSheet( "background-color: rgb(255, 255, 255,0);") self.bsalemethod.setObjectName("bsalemethod") # 제품별 매출 버튼 self.bsalegoods = QtWidgets.QPushButton(self.centralwidget) self.bsalegoods.setGeometry(QtCore.QRect(1193, 516, 185, 121)) self.bsalegoods.setStyleSheet( "background-color: rgb(255, 255, 255,0);") self.bsalegoods.setObjectName("bsalegoods") self.bsalegoods.clicked.connect(self.bsalegoods_clicked) self.choosedate = QtWidgets.QLineEdit(self.centralwidget) self.choosedate.setGeometry(QtCore.QRect(1011, 102, 356, 75)) self.choosedate.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/1.png);") self.choosedate.setObjectName("choosedate") # 총 매출 self.allsales = QtWidgets.QLineEdit(self.centralwidget) self.allsales.setGeometry(QtCore.QRect(1011, 240, 357, 131)) self.allsales.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/2.png);") self.allsales.setObjectName("allsales") # 사용종료 버튼 self.boff = QtWidgets.QPushButton(self.centralwidget) self.boff.setGeometry(QtCore.QRect(1000, 643, 380, 61)) self.boff.setStyleSheet("background-color: rgb(255, 255, 255,0);") self.boff.setObjectName("boff") # 결제 수단별 이미지 self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.label_2.setPixmap(QtGui.QPixmap("image/fr7.png")) self.label_2.setScaledContents(True) self.label_2.setObjectName("label_2") self.moneytxt = QtWidgets.QLineEdit(self.centralwidget) self.moneytxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.moneytxt.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/3.png);") self.moneytxt.setObjectName("moneytxt") self.cardtxt = QtWidgets.QLineEdit(self.centralwidget) self.cardtxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.cardtxt.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/3.png);") self.cardtxt.setObjectName("cardtxt") self.gifttxt = QtWidgets.QLineEdit(self.centralwidget) self.gifttxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.gifttxt.setStyleSheet("background-color: rgb(255, 255, 255,0);\n" "font: 28pt \"Arial\";" "border-image: url(image/3.png);") self.gifttxt.setObjectName("gifttxt") # 결제수단별 리스트 출력 하는곳 self.goodslistview = QtWidgets.QTextEdit(self.centralwidget) self.goodslistview.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.goodslistview.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "font: 20pt \"Fixedsys\";" "border-image: url(image/fr6.png);") self.goodslistview.setObjectName("goodslistview") self.sales_list_attribute = QtWidgets.QPushButton(self.centralwidget) self.sales_list_attribute.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.sales_list_attribute.setStyleSheet( "background-color: rgb(255, 255, 255,0);\n" "border-image: url(image/sales_list_attribute.png);") self.sales_list_attribute.setObjectName('sales_list_attribute') self.bday.clicked.connect(self.bday_clicked) self.bmonth.clicked.connect(self.bmonth_clicked) self.byear.clicked.connect(self.byear_clicked) self.bsalemethod.clicked.connect(self.bsalemethod_clicked) self.bsalegoods.clicked.connect(self.bsalegoods_clicked) QtCore.QMetaObject.connectSlotsByName(Dialog) def bday_clicked(self): ''' '일별 매출' 버튼 클릭 이벤트 해당 날짜의 '년,월,일'을 받아와서 그 날의 매출을 출력함 :return: ''' self.__mode = 'day' date = self.calendar.selectedDate() tmp = date.toString("yyyy-MM-dd") self.__year, self.__month, self.__day = tmp.split('-') self.choosedate.setText(" " + self.__year + "년" + self.__month + "월" + self.__day + "일") pay = Payment_manage() total_money = pay.check_sales_today(int(self.__year), int(self.__month), int(self.__day)) self.allsales.setText(" " + self.common_function.insert_comma(total_money) + "원") def bmonth_clicked(self): ''' '월별 매출' 버튼 클릭 이벤트 해당 날짜의 '년,월'을 받아와서 그 달의 매출을 출력함 :return: ''' self.__mode = 'month' date = self.calendar.selectedDate() tmp = date.toString("yyyy-MM-dd") self.__year, self.__month, self.__day = tmp.split('-') # self.__day = None self.choosedate.setText(" " + self.__year + "년" + self.__month + "월") pay = Payment_manage() total_money = pay.check_sales_month(int(self.__year), int(self.__month)) self.allsales.setText(" " + self.common_function.insert_comma(total_money) + "원") def byear_clicked(self): ''' '연별 매출' 버튼 클릭 이벤트 해당 날짜의 '년'을 받아와서 그 해의 매출을 출력함 :return: ''' self.__mode = 'year' year = str(self.calendar.yearShown()) self.__year = year # self.__month, self.__day = None, None self.choosedate.setText(" " + year + "년") pay = Payment_manage() total_money = pay.check_sales_year(int(self.__year)) self.allsales.setText(" " + self.common_function.insert_comma(total_money) + "원") def bsalemethod_clicked(self): ''' '결제 수단별 매출' 버튼 클릭 이벤트 이전에 클릭한 버튼에 따라 결제 수단별 매출금액을 출력함 :return: ''' if self.__year == None and self.__month == None and self.__day == None: self.common_function.msg_box('날짜를 클릭하시오. ') return self.label_2.setGeometry(QtCore.QRect(12, 449, 973, 266)) self.moneytxt.setGeometry(QtCore.QRect(48, 592, 262, 86)) self.cardtxt.setGeometry(QtCore.QRect(369, 592, 262, 86)) self.gifttxt.setGeometry(QtCore.QRect(689, 592, 262, 86)) self.goodslistview.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.sales_list_attribute.setGeometry(QtCore.QRect(0, 0, 0, 0)) date = self.calendar.selectedDate() tmp = date.toString("yyyy-MM-dd") self.__year, self.__month, self.__day = tmp.split('-') cash, card, gift = 0, 0, 0 pay = Payment_manage() if self.__mode == 'day': paylist = pay.check_sales_day_return_paylist( self.__year, self.__month, self.__day) if (len(paylist) == 0): pass else: real_paylist = sum(paylist, []) for i in real_paylist: if i[2] == '카드': card += i[4] if i[2] == '현금': cash += i[4] if i[2] == '상품권': gift += i[4] elif self.__mode == 'month': paylist = pay.check_sales_month_return_paylist( self.__year, self.__month) if (len(paylist) == 0): pass else: real_paylist = sum(paylist, []) for i in real_paylist: if i[2] == '카드': card += i[4] if i[2] == '현금': cash += i[4] if i[2] == '상품권': gift += i[4] elif self.__mode == 'year': paylist = pay.check_sales_year_return_paylist(self.__year) if (len(paylist) == 0): pass else: real_paylist = sum(paylist, []) for i in real_paylist: if i[2] == '카드': card += i[4] if i[2] == '현금': cash += i[4] if i[2] == '상품권': gift += i[4] self.moneytxt.setText(' ' + self.common_function.insert_comma(cash) + '원') self.cardtxt.setText(' ' + self.common_function.insert_comma(card) + '원') self.gifttxt.setText(' ' + self.common_function.insert_comma(gift) + '원') def bsalegoods_clicked(self): ''' 결제 수단별 매출' 버튼 클릭 이벤트 이전에 클릭한 버튼에 따라 제품별 매출금액을 출력함 :return: ''' if self.__year == None and self.__month == None and self.__day == None: self.common_function.msg_box('날짜를 클릭하시오. ') return date = self.calendar.selectedDate() tmp = date.toString("yyyy-MM-dd") self.__year, self.__month, self.__day = tmp.split('-') self.goodslistview.setGeometry(QtCore.QRect(13, 449, 973, 266)) self.sales_list_attribute.setGeometry(QtCore.QRect(26, 455, 935, 41)) self.label_2.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.moneytxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.cardtxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.gifttxt.setGeometry(QtCore.QRect(0, 0, 0, 0)) buf = '\n\n\n\n' pay = Payment_manage() if self.__mode == 'day': paylist = pay.check_sales_product_real_day(int(self.__year), int(self.__month), int(self.__day)) if (len(paylist) == 0): pass else: real_paylist = sum(paylist, []) sorted_paylist = sorted(real_paylist, key=lambda paylist: paylist[5], reverse=True) n = 1 for text in sorted_paylist: # text -> 이름 수량 원가 영수증번호 행사상품 총가격 제품번호 if n < 10: num = '0' + str(n) else: num = str(n) # 번호 바코드 품목명 단가 수량 금액 행사 buf += self.list_print(num, text[6], text[0], text[2], text[1], text[5], text[4]) n += 1 elif self.__mode == 'month': paylist = pay.check_sales_product_real_month( int(self.__year), int(self.__month)) if (len(paylist) == 0): pass else: real_paylist = sum(paylist, []) sorted_paylist = sorted(real_paylist, key=lambda paylist: paylist[5], reverse=True) n = 1 for text in sorted_paylist: # text -> 이름 수량 원가 영수증번호 행사상품 총가격 제품번호 total = self.common_function.event_processing_return( text[4], text[1], text[2]) if n < 10: num = '0' + str(n) else: num = str(n) # 번호 바코드 품목명 단가 수량 금액 행사 buf += self.list_print(num, text[6], text[0], text[2], text[1], text[5], text[4]) n += 1 elif self.__mode == 'year': paylist = pay.check_sales_product_real_year(int(self.__year)) if (len(paylist) == 0): pass else: real_paylist = sum(paylist, []) sorted_paylist = sorted(real_paylist, key=lambda paylist: paylist[5], reverse=True) n = 1 for text in sorted_paylist: # text -> 이름 수량 원가 영수증번호 행사상품 총가격 제품번호 total = self.common_function.event_processing_return( text[4], text[1], text[2]) if n < 10: num = '0' + str(n) else: num = str(n) # 번호 바코드 품목명 단가 수량 금액 행사 buf += self.list_print(num, text[6], text[0], text[2], text[1], text[5], text[4]) n += 1 self.goodslistview.setText(buf) def list_print(self, num, barcode, name, price, quantity, total_price, event): buf = ' ' * 4 + self.list_print_function.number_print(num) + str( barcode) + ' ' * 10 + self.list_print_function.name_print( name) + ' ' + self.list_print_function.price_print( price) + ' ' + self.list_print_function.count_print( quantity) + ' ' + self.list_print_function.price_print( str(total_price) ) + ' ' + self.list_print_function.event_print( event) + '\n' return buf