• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            socketref,再見!高德

            https://github.com/adoggie

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              246 Posts :: 4 Stories :: 312 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(54)

            我參與的團隊

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            啊關的企業在處理用友erp人事數據與稅務報稅時轉換數據時被停滯了,一個小時內完成他的需求
              1 # -*- coding:utf-8 -*-
              2 # soctt.bin created  2011.8.29
              3 # sw2us.com @2011 
              4 #
              5 
              6 import sys,os,os.path,time,struct,traceback,threading,datetime,string,datetime,calendar
              7 import xlrd
              8 
              9 start_year=0
             10 start_month= 0
             11 start_day =1 
             12 end_day = start_day 
             13 
             14 end_year= 0
             15 end_month = 0
             16 
             17 employee_importFile=u'111111111.XLS'
             18 tax_importFile=u'題橋工資格式.xls'
             19 
             20 employee_exportFile=u'empolyees.txt'
             21 tax_exportFile=u'personTax.txt'
             22 employeelistfile='employee_simplelist.txt'
             23 
             24 fixDeduct = 2000.00 #扣除額
             25 
             26 #人員歸檔
             27 def employeeAchive():
             28     title = u'工號~~姓名~~證件類型~~證件號~~性別~~出生日期~~國家、地區~~開票標志~~申報方式~~職務~~地址~~含稅標志~~郵政編碼~~調入調離~~備注'
             29     #rowfmt = u"%s~~ %s~~  1       ~~%s    ~~0   ~~%s      ~~142       ~~1       ~~0       ~~    ~~    ~~1       ~~        ~~0       ~~0"
             30     rowfmt = u"%s~~ %s~~  1       ~~%s    ~~0   ~~%s      ~~142       ~~1       ~~0       ~~    ~~    ~~1       ~~        ~~0       ~~0"
             31     rowfmt = rowfmt.replace(' ','')
             32     
             33     wb = xlrd.open_workbook(employee_importFile) 
             34     sh = wb.sheet_by_index(0)
             35     file = open(employee_exportFile,'w')
             36     title = title.encode('gbk')
             37     file.write(title)
             38     file.write('\n')
             39     
             40     file2 = open(employeelistfile,'w'#清單表2
             41     for r in range(1,sh.nrows):
             42         v = sh.row_values(r)
             43         v = map(string.strip,v)
             44         
             45         
             46         birth = ''
             47         try:
             48             y,m,d = v[4].split('-')
             49             birth = "%04d%02d%02d"%(int(y),int(m),int(d))
             50         except:
             51             print u'出生年月空缺 (%s,%s)'%(v[1],v[2])
             52         
             53         txt = rowfmt%(v[1],v[2],v[5],birth)
             54         txt = txt.encode('gbk')
             55         #print len(txt)
             56         file.write(txt+'\n')
             57         
             58         txt = "%s~~%s~~%s\n"%(v[1],v[2],v[5])
             59         txt = txt.encode('gbk')
             60         
             61         file2.write(txt)
             62         
             63     file.close()
             64     file2.close()
             65     
             66 
             67 def precess_parameters():
             68     global start_year,start_month,end_year,end_month,start_day,end_day
             69     
             70     cur = datetime.datetime.now()
             71     start_year = cur.year
             72     start_month = cur.month
             73     #print len(sys.argv)
             74     if len(sys.argv) == 4 and sys.argv[1]=='tax':
             75         start_year = int(sys.argv[2]) 
             76         start_month = int(sys.argv[3])
             77     
             78     start_day = 1
             79     x,end_day= calendar.monthrange(start_year,start_month)
             80     
             81     
             82     
             83 def salaryTax():
             84     global start_year,start_month,end_year,end_month,start_day,end_day
             85     
             86     precess_parameters()
             87 
             88     hashemployee = {}
             89     file = open(employeelistfile,'r')
             90     lines = file.readlines()
             91     file.close()
             92     for line in lines:
             93         line = line.strip().split('~~')
             94         k = line[0]
             95         v = line[2]
             96         hashemployee[k] = v
             97     #以上建立員工查找表
             98     
             99     
            100     title = u'證件類型~~證件號碼~~稅目代碼~~含稅標志~~所屬期起~~所屬期止~~天數~~收入額~~扣除額~~應繳稅額~~國家地區~~減免稅額~~實繳稅額'
            101     #rowfmt = u"1     ~~%s      ~~010000  ~~1       ~~%s      ~~%s      ~~%s  ~~%s    ~~%s    ~~%s      ~~142     ~~0       ~~%s"
            102     rowfmt =  u"1     ~~%s      ~~010000  ~~1       ~~%s      ~~%s      ~~%s  ~~%s    ~~%s    ~~%s      ~~142     ~~0       ~~%s"
            103     rowfmt = rowfmt.replace(' ','')
            104     
            105     wb = xlrd.open_workbook(tax_importFile) 
            106     sh = wb.sheet_by_index(0)
            107     file = open(tax_exportFile,'w')
            108     title = title.encode('gbk')
            109     file.write(title)
            110     file.write('\n')
            111     
            112     for r in range(1,sh.nrows):
            113         v = sh.row_values(r)
            114         
            115         v = map(unicode,v)
            116         v = map(string.strip,v)
            117         sid = '' #身份證編號
            118         try:        
            119             sid = hashemployee[v[1]]
            120         except:
            121             print u'處理異常中斷: 工號不能匹配! 工號: %s'%(v[1])
            122             return 
            123             sys.exit(0)
            124         start = "%04d%02d%02d"%(start_year,start_month,start_day)
            125         end = "%04d%02d%02d"%(start_year,start_month,end_day)        
            126         txt = rowfmt%(sid,start,end, end_day-start_day+1,v[22],fixDeduct,v[24],v[24] ) #應發工資 W(v[22])
            127         txt = txt.encode('gbk')        
            128         file.write(txt+'\n')
            129     file.close()
            130     
            131 
            132 if __name__=='__main__':
            133     employeeAchive()
            134     salaryTax()
            135    
            posted on 2011-08-30 11:28 放屁阿狗 閱讀(280) 評論(0)  編輯 收藏 引用 所屬分類: perl/python/php/lua/tcl
            欧美噜噜久久久XXX| 久久香蕉国产线看观看精品yw| 亚洲国产精品一区二区久久hs| Xx性欧美肥妇精品久久久久久| 久久精品亚洲日本波多野结衣| 日本久久久久久久久久| 久久久精品午夜免费不卡| 无码人妻精品一区二区三区久久久| 久久国产免费| 久久天天躁狠狠躁夜夜av浪潮| 久久久九九有精品国产| 狠狠狠色丁香婷婷综合久久俺| 久久久久久午夜成人影院 | 国产精品久久久久天天影视| 色狠狠久久AV五月综合| 青草国产精品久久久久久| 色综合久久久久综合体桃花网| 亚洲国产精品久久久天堂| 久久久噜噜噜久久中文字幕色伊伊| 亚洲中文字幕伊人久久无码| 日韩va亚洲va欧美va久久| 日韩十八禁一区二区久久 | 久久久久久av无码免费看大片| 国产AV影片久久久久久 | 精品久久久久久无码中文野结衣| 久久精品国产精品国产精品污 | 精品久久久久久国产免费了| 久久久WWW成人免费毛片| 久久久无码精品亚洲日韩京东传媒| 国内精品综合久久久40p| 九九精品99久久久香蕉| 国产精品美女久久久免费| 色8激情欧美成人久久综合电| 久久久久久伊人高潮影院| 国产成人综合久久综合| 久久久久99精品成人片三人毛片| 亚洲va久久久久| 99久久免费国产精品热| 久久久久无码精品国产app| 天天爽天天狠久久久综合麻豆| 久久99国内精品自在现线|