Beispiel #1
0
def getXlsxString(sh, i, in_columns_j):
    impValues = {}
    for item in in_columns_j.keys() :
        j = in_columns_j[item]
        if item in ('закупка','продажа','цена','цена1') :
            if getCellXlsx(row=i, col=j, isDigit='N', sheet=sh)=='':
                j = j+1                                 # иногда цена бывает в следующей колонке.
            if getCellXlsx(row=i, col=j, isDigit='N', sheet=sh).find('request') >=0 :
                impValues[item] = '0.1'
            else :
                impValues[item] = getCellXlsx(row=i, col=j, isDigit='Y', sheet=sh)
            #print(sh, i, sh.cell( row=i, column=j).value, sh.cell(row=i, column=j).number_format, currencyType(sh, i, j))
        elif item == 'валюта_по_формату':
            impValues[item] = currencyType(row=i, col=j, sheet=sh)
        elif item == 'short_descr':
            if getCellXlsx(row=i, col=j, isDigit='N', sheet=sh)=='':
                j = 3                                 # иногда краткое описание бывает в колонке "С"
            impValues['short_descr'] = getCellXlsx(row=i, col=j, isDigit='N', sheet=sh)
        elif item == 'long_descr':
            long_descr=[]
            for k in range(7, 45):
                tempVal = getCellXlsx(row=i, col=k, isDigit='N', sheet=sh)
                if tempVal != '':
                    long_descr.append(tempVal)
            impValues['long_descr'] = '; '.join(long_descr)
        elif item == 'код_' :
             impValues['код_'] = getCellXlsx(row=i, col=j, isDigit='N', sheet=sh).lstrip('0')
        else:
            impValues[item] = getCellXlsx(row=i, col=j, isDigit='N', sheet=sh)
    return impValues
Beispiel #2
0
def getXlsxString(sh, i, in_columns_j):
    impValues = {}
    for item in in_columns_j.keys():
        j = in_columns_j[item]
        if item in ('закупка', 'продажа', 'цена', 'цена1', 'цена2', 'цена3'):
            impValues[item] = getCellXlsx(row=i, col=j, isDigit='Y', sheet=sh)
        elif item == 'валюта_по_формату':
            impValues[item] = currencyType(row=i, col=j, sheet=sh)
        else:
            impValues[item] = getCellXlsx(row=i, col=j, isDigit='N', sheet=sh)
    return impValues
Beispiel #3
0
def getXlsxString(sh, i, in_columns_j):
    impValues = {}
    for item in in_columns_j.keys():
        j = in_columns_j[item]
        if item in ('закупка', 'продажа', 'цена'):
            if getCellXlsx(row=i, col=j, isDigit='N', sheet=sh).find('звоните') >= 0:
                impValues[item] = '0.1'
            else:
                impValues[item] = getCellXlsx(row=i, col=j, isDigit='Y', sheet=sh)
            #print(sh, i, sh.cell( row=i, column=j).value, sh.cell(row=i, column=j).number_format, currencyType(sh, i, j))
        elif item == 'валюта_по_формату':
            impValues[item] = currencyType(row=i, col=j, sheet=sh)
        else:
            impValues[item] = getCellXlsx(row=i, col=j, isDigit='N', sheet=sh)
    return impValues
Beispiel #4
0
def getXlsString(sh, i, in_columns_j):
    #print(type(sh))                    #   <class 'xlrd.sheet.Sheet'>
    impValues = {}
    for item in in_columns_j.keys():
        j = in_columns_j[item] - 1
        if item in ('закупка', 'продажа', 'цена со скидкой', 'цена_'):
            if getCell(row=i, col=j, isDigit='N',
                       sheet=sh) == '':  # .find('Звоните') >=0 :
                impValues[item] = '0.1'
            else:
                impValues[item] = getCell(row=i, col=j, isDigit='Y', sheet=sh)
            #print(sh, i, sh.cell( row=i, column=j).value, sh.cell(row=i, column=j).number_format, currencyType(sh, i, j))
        elif item == 'валюта_по_формату':
            impValues[item] = currencyType(row=i, col=j, sheet=sh)
        else:
            impValues[item] = getCell(row=i, col=j, isDigit='N', sheet=sh)
    return impValues