Beispiel #1
0
    def GetLink(self, res):
        listrec = []
        showlinkfile = 0
        basename = 0
        absfilename = 0
        if not os.access('../../base/', os.F_OK):
            os.mkdir('../../base/')
        if not os.access('../../base/files/', os.F_OK):
            os.mkdir('../../base/files/')
        if not os.access('../../base/files/reports/', os.F_OK):
            os.mkdir('../../base/files/reports/')
        if not os.access('../../base/files/reports/movingwares/', os.F_OK):
            os.mkdir('../../base/files/reports/movingwares/')
        if not os.access('../../base/files/reports/movingwares/detail/',
                         os.F_OK):
            os.mkdir('../../base/files/reports/movingwares/detail/')
        pathname = '../../base/files/reports/movingwares/detail/'
        filename = str(pathname) + str(
            'ƒвижение товара') + '_' + str(
                self.GetCurDateTime()) + '.xls'
        #pathname = os.path.dirname(os.path.abspath(filename))
        showlinkfile = 0
        if os.access(filename, os.F_OK):
            #delfile = self.getIfaceVar('delfile')
            #if delfile=='yes':
            #os.remove(filename)
            #else:
            showlinkfile = self.GetFileNames(filename)
        if filename:
            linerec = ''
            if not os.access(pathname, os.F_OK):
                os.mkdir(pathname)
            f = open(filename, 'wb')
            #header
            linerec = _('Date') + '\t'
            linerec += _('Type operation') + '\t'
            linerec += _('Document number') + '\t'
            linerec += _('From whom') + '\t'
            linerec += _('To whom') + '\t'
            linerec += _('Count') + '\r\n'
            f.writelines(linerec)
            listrec.append(linerec)
            #body
            for item in res['datalist']:
                linerec = str(TimeStampToDate(item['DOCDATE'])) + '\t'
                linerec += self.ValToStr(item['DOCTYPENAME']) + '\t'
                linerec += self.ValToStr(item['DOCNUM']) + '\t'
                linerec += self.ValToStr(item['FROMNAME']) + '\t'
                linerec += self.ValToStr(item['TONAME']) + '\t'
                linerec += self.ValToStr(item['CNT']) + '\r\n'
                f.writelines(linerec)
                listrec.append(linerec)
            f.close()

        return self.GetFileNames(filename)
Beispiel #2
0
        #проставим время
        self.dbExec(
            sql=
            'update wm_task_wares tw set tw.begintime = current_timestamp where tw.taskid = ? and tw.waresid = ? and tw.begintime is NULL',
            params=[tid, wid],
            fetch='none')
        if prdate:
            params['prdate'] = prdate
        else:
            ld = self.dbExec(
                sql='select * from K_WH_INCOME_WARESLASTDATA(?,?)',
                params=[tid, wid],
                fetch='one')
            if ld and ld['PRODUCTDATE']:
                params['prdate'] = TimeStampToDate(ld['PRODUCTDATE'])
            else:
                params['prdate'] = self.dateMask
        w = self.waresInfo(wid)
        wt = self.waresType(wid)
        if amount:
            params['amount'] = amount
        else:
            params['amount'] = ''
        if wuid:
            wu = self.waresUnitInfo(waresunitid=wuid)
        else:
            wu = None
            params['wuid'] = wuid
        extDL = self.qTaskWaresAddExtDatalist(tid, wid)
        if extDL:
Beispiel #3
0
                    sql="select * from K_SELECTFROST_TASKCREATE_PVIEW(?)",
                    fetch='all',
                    params=[docid])
            else:
                data = self.dbExecC(
                    sql='select * from WH_DC_TASKSELECT_CREATE_PREVIEW(?)',
                    params=[docid],
                    fetch='all')
        except FBExc, exc:
            return self.pyDumps(ext_data={'errMes': exc[1]})
        return self.pyDumps(data=data,
                            ext_data={
                                'ALGO': d['ALGO'],
                                'DOCID': docid,
                                'DOCNUM': d['DOCNUM'],
                                'RDOCDATE': TimeStampToDate(d['RDOCDATE'])
                            })

    docSelectPreview.exposed = True

    def docToSelect(self, docid):
        try:
            d = self.dbExecC(sql='select * from K_SELMANAG_DOCTOSELECT(?)',
                             params=[docid],
                             fetch='one')
        except FBExc, exc:
            return self.pyDumps(ext_data={'errMes': exc[1]})
        return self.pyDumps(data=d)

    docToSelect.exposed = True