Add partial temp main for prepare scales

This commit is contained in:
oscar alvarez 2023-05-24 16:18:13 -05:00
parent e3d6296495
commit 3a9ab498b5
5 changed files with 3590 additions and 11 deletions

View File

@ -11,21 +11,11 @@ from pathlib import Path
from PySide6.QtWidgets import (QMainWindow, QDialog)
from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QPixmap
# from PyQt5.QtWidgets import (QDialogButtonBox, QPushButton,
# QLineEdit, QHBoxLayout, QFrame, QLabel,
# QVBoxLayout, QStyle,)
# from PyQt5.QtCore import Qt
from http.client import HTTPConnection, HTTPSConnection
import orjson as json
from app.threads import VerifyConn
# from app.commons import connection
# from app.commons import common
from app.commons.config import Params
# from app.commons.dialogs import QuickDialog
# from app.commons.forms import GridForm
# from ..version import __version__
from app.commons.ui_login import Ui_Login
# from app.css.flat_button_small import *
context_http = ssl._create_unverified_context()
_ = gettext.gettext

View File

@ -234,6 +234,7 @@ class FrontWindow(QMainWindow):
self.Config = Model('sale.configuration', self.ctx)
self.Sale = Model('sale.sale', self.ctx)
self._config, = self.Config.find([('id', '=', 1)])
self.discount_method = self._config.get('discount_pos_method')
self.allow_discount_handle = self._config.get('allow_discount_handle', None)
self.sale_automatic = False

3489
app/main (copy).py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -63,4 +63,4 @@ language=es_CO
enviroment=retail
profile_name=MY DEMO
activate_scale_sync=False

99
sync_scale.py Normal file
View File

@ -0,0 +1,99 @@
import os
if os.name == 'posix':
dir = '/home/psk/Documents/DIBAL'
else:
dir = r'D:\USUARIOS\USUARIO\Desktop\TICKETS DIBAL'
files = os.listdir(dir)
print('dir....', files)
name_file = '2000150560643.txt'
# fullpath = os.path.join(dir, name_file)
# with open(fullpath) as f:
# lines = f.readlines()
#
#
# for line in lines:
# print("*" * 100)
# print("leyendo el archivo.....", name_file)
# print(line)
#
# code_product = line[:5]
# weight = line[5:11]
# unit_price = line[11:16]
# amount = line[16:22]
# date_ = line[22:28]
# time_ = line[28:32]
# salesman = line[32:37]
# scale_code = line[37:39]
# ticket = line[39:]
# # code_product
# print('code_product ', code_product)
# print('weight ', weight)
# print('unit_price ', unit_price)
# print('amount ', amount)
# print('date_ ', date_)
# print('time_ ', time_)
# print('salesman ', salesman)
# print('scale_code ', scale_code)
# print('ticket ', ticket)
def read_files_scale():
new_sales = []
for _file in files:
if not '.txt' in _file:
continue
fullpath = os.path.join(dir, _file)
new_sale = None
with open(fullpath) as f:
new_sale = {}
lines = f.readlines()
lines_to_add = []
for line in lines:
print("*" * 100)
print("leyendo el archivo.....", name_file)
print(line)
product = line[:5].rstrip()
weight = line[5:11].rstrip()
unit_price = line[11:16].rstrip()
amount = line[16:22].rstrip()
date_ = line[22:28].rstrip()
time_ = line[28:32].rstrip()
salesman = line[32:37].rstrip()
scale_code = line[37:39].rstrip()
ticket = line[39:].rstrip()
print('product ', product)
print('weight ', weight)
print('unit_price ', unit_price)
print('amount ', amount)
print('date_ ', date_)
print('time_ ', time_)
print('salesman ', salesman)
print('scale_code ', scale_code)
print('ticket ', ticket)
if not new_sale:
new_sale = {
'date_': date_,
'time_': time_,
'salesman': salesman,
'scale_code': scale_code,
'ticket': ticket,
'lines': [],
}
line = {
'product': product,
'weight': weight,
'unit_price': unit_price,
'amount': amount,
'date_': date_,
'time_': time_,
}
lines_to_add.append(line)
new_sale['lines'] = lines_to_add
new_sales.append(new_sale)
return new_sales