Пример #1
0
    def initData(self):
        self.idxdata = {}
        self.initTaskList()
        self.tvMain.setHeaderLabels([
            u'序号',
            u'状态',
            u'发票种类',
            u'发票代码',
            u'发票号码',
            u'客户名称',
            u'客户税号',
            u'客户地址',
            u'客户银行及账号',
            u'开票日期',
            u'开票金额',
            u'税率',
            u'税额',
            u'主要商品名称',
            u'商品税目',
            u'备注信息',
        ])
        #self.listRecords.setHorizontalHeaderLabels(['a','b'])
        self.tvMain.resizeColumnToContents(0)

        self.tvGoods.setHeaderLabels([
            u'序号', u'商品名称', u'商品税目', u'商品规格', u'计量单位', u'数量', u'单价', u'税率',
            u'税额', u'是否含税'
        ])
        #self.listRecords.setHorizontalHeaderLabels(['a','b'])
        self.tvGoods.resizeColumnToContents(0)

        self.tvClients.setHeaderLabels([u'客户税号', u'客户名称'])
        self.tvClients.resizeColumnToContents(0)

        now = datetime.datetime.now()
        text = '%04d-%02d-%02d' % (now.year, now.month, now.day)
        self.edtStart.setText(text)
        self.edtEnd.setText(text)
        self.edtStartImport.setText(text)
        self.edtEndImport.setText(text)

        self.db = taxcache.TaxMemDB(self.libfile)
        #		print self.libfile
        try:
            if os.path.exists(self.confile):
                f = open(self.confile)
                self.props = pickle.load(f)
                f.close()
                self.edtCorpName.setText(
                    QString.fromUtf8(self.props['corpname']))
                self.edtTaxcode.setText(QString.fromUtf8(
                    self.props['taxcode']))
                self.edtAddress.setText(QString.fromUtf8(
                    self.props['address']))
                self.edtBank.setText(QString.fromUtf8(self.props['bank']))
        except:
            pass

        self.loadClientLicenses()
Пример #2
0
import taxctrl
import taxcache
import taxbase


def formatTimestamp():
    try:
        dt = datetime.datetime.now()
        return "%04d%02d%02d %02d:%02d:%02d" % (dt.year, dt.month, dt.day,
                                                dt.hour, dt.minute, dt.second)
    except:
        return ''


taxctrl.init_plugin()
db = taxcache.TaxMemDB('system.lib')
doc = taxbase.TaxDocument.from_db(db.handle(), 'amao21131511-117')
f = open('invoice.log', 'w')

for n in range(800):
    r, emsg, code, number, date, amount, tax = taxctrl.create_invoice(doc)
    now = formatTimestamp()
    print r, emsg, code, number, date, amount, tax
    f.write('%s : %s %s %s %s %s %s %s \n' %
            (now, r, emsg, code, number, date, amount, tax))

    time.sleep(2)
    f.flush()
f.close()
taxctrl.freepluger()
Пример #3
0
    def initData(self):
        self.idxdata = {}  #{ti:(taxcode,taxnumber)}
        self.selected_invoices = {}  #{ti:{invoice_fields}}

        self.initTaskList()
        self.tvMain.setHeaderLabels([
            u'序号',
            u'发票种类',
            u'供应商名称',
            u'供应商税号',
            u'发票代码',
            u'发票号码',
            u'客户名称',
            u'客户税号',
            u'客户地址',
            u'客户银行及账号',
            u'开票日期',
            u'开票金额',
            u'税率',
            u'税额',
            u'主要商品名称',
            u'商品税目',
            u'备注信息',
        ])
        #self.listRecords.setHorizontalHeaderLabels(['a','b'])
        self.tvMain.resizeColumnToContents(0)

        self.tvGoods.setHeaderLabels([
            u'序号', u'商品名称', u'商品税目', u'商品规格', u'计量单位', u'数量', u'单价', u'税率',
            u'税额', u'是否含税'
        ])
        #self.listRecords.setHorizontalHeaderLabels(['a','b'])
        self.tvGoods.resizeColumnToContents(0)

        now = datetime.datetime.now()
        text = '%04d-%02d-%02d' % (now.year, now.month, now.day)
        self.edtStart.setText(text)
        self.edtEnd.setText(text)

        #---------------------------------------------------------------
        self.tvMain_SelectList.setHeaderLabels([
            #			u'序号',
            u'发票种类',
            u'供应商名称',
            u'供应商税号',
            u'发票代码',
            u'发票号码',
            u'客户名称',
            u'客户税号',
            u'客户地址',
            u'客户银行及账号',
            u'开票日期',
            u'开票金额',
            u'税率',
            u'税额',
            u'主要商品名称',
            u'商品税目',
            u'备注信息',
        ])
        #self.listRecords.setHorizontalHeaderLabels(['a','b'])
        self.tvMain_SelectList.resizeColumnToContents(0)

        self.tvGoods_SelectList.setHeaderLabels([
            u'序号', u'商品名称', u'商品税目', u'商品规格', u'计量单位', u'数量', u'单价', u'税率',
            u'税额', u'是否含税'
        ])
        #self.listRecords.setHorizontalHeaderLabels(['a','b'])
        self.tvGoods_SelectList.resizeColumnToContents(0)

        self.db = taxcache.TaxMemDB(self.libfile)

        r = self.loadClientLicense()
Пример #4
0
    def __init__(self, app):
        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)
        self.app = app
        self.db = None
        self.show()
        self.timer = QTimer()

        self.connect(self.timer, SIGNAL('timeout()'), self.onTimerTrigger)
        self.connect(self.btnInvQuery, SIGNAL('clicked()'),
                     self.onBtnInvQueryClick)
        self.connect(self.btnInvCancel, SIGNAL('clicked()'),
                     self.onBtnInvCancelClick)
        self.connect(self.btnInvRed, SIGNAL('clicked()'),
                     self.onBtnInvRedClick)
        self.connect(self.btnReadDir, SIGNAL('clicked()'),
                     self.onBtnReadDirClick)

        self.connect(self.btnInvPrint, SIGNAL('clicked()'),
                     self.onBtnInvPrintClick)
        self.connect(self.btnInvExport, SIGNAL('clicked()'),
                     self.onBtnInvExportClick)

        self.connect(self.tvInvMain,
                     SIGNAL('itemClicked(QTreeWidgetItem*,int)'),
                     self.onTreeItemClick_InvMain)
        #		self.connect(self.tvInvGoods,SIGNAL('itemClicked(QTreeWidgetItem*,int)'),self.onTreeItemClick_InvGoods)

        self.connect(self.tvDocMain,
                     SIGNAL('itemClicked(QTreeWidgetItem*,int)'),
                     self.onTreeItemClick_DocMain)
        self.connect(self.tvDocGoods,
                     SIGNAL('itemClicked(QTreeWidgetItem*,int)'),
                     self.onTreeItemClick_DocGoods)

        self.connect(self.btnDocQuery, SIGNAL('clicked()'),
                     self.onBtnDocQueryClick)
        #		self.connect(self.btnTodayDoc,SIGNAL('clicked()'),self.onBtnTodayDocClick)
        self.connect(self.btnDocDel, SIGNAL('clicked()'),
                     self.onBtnDocDelClick)
        self.connect(self.btnDocImport, SIGNAL('clicked()'),
                     self.onBtnDocImportClick)
        self.connect(self.btnDocInvoice, SIGNAL('clicked()'),
                     self.onBtnDocInvoiceClick)

        self.connect(self.btnSave, SIGNAL('clicked()'), self.onBtnSaveProfile)
        self.connect(self.btnSyncManual, SIGNAL('clicked()'),
                     self.onBtnSyncManual)

        self.connect(self.btnResetClear, SIGNAL('clicked()'),
                     self.onBtnResetClear)

        #		self.initUi()

        self.mtxthis = threading.Lock()
        self.confile = 'local.profile'
        self.libfile = '%s/taxexp.dll' % (win32api.GetSystemDirectory())
        self.libfile = 'system.lib'
        self.props = {
            'corpname': '',
            'taxcode': '',
            'address': '',
            'bank': '',
            'branch': '',
            'server_addr': '',
            'server_port': '',
            'is_sync_server': False,
            'is_doc_autoread': False,
            'doc_readdir': ''
        }

        #数据库
        self.db = taxcache.TaxMemDB(self.libfile)
        self.initData()

        #		self.workthread = threading.Thread(target=self.work_thread)
        #		self.workthread.start()
        #		self.app_exiting =False

        self.timer.start(1000 * 1)

        title = self.windowTitle() + '  ( %s )' % APP_VERSION
        self.setWindowTitle(title)