• <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
            一本色道久久综合狠狠躁篇 | 色欲久久久天天天综合网精品 | 91精品国产色综合久久| 久久精品国产第一区二区三区| 亚洲精品乱码久久久久久 | 久久国产欧美日韩精品| 性欧美大战久久久久久久久| 国产精品久久免费| 色综合久久中文字幕综合网| 精品人妻伦九区久久AAA片69| 久久99精品久久久久久| 久久精品国产亚洲AV不卡| 亚洲午夜久久久影院| 色综合久久88色综合天天| 欧美日韩久久中文字幕| 久久这里只有精品久久| 99久久国产宗和精品1上映| 久久久久国产精品| 久久精品国产亚洲AV香蕉| 国产精品美女久久久网AV| 亚洲AV日韩精品久久久久久久| 久久AAAA片一区二区| 精品久久久噜噜噜久久久| 97视频久久久| 久久久久99精品成人片| 久久久无码一区二区三区| 色综合久久久久综合99| segui久久国产精品| 99999久久久久久亚洲| 久久午夜无码鲁丝片秋霞| 久久久久人妻精品一区三寸蜜桃| 精品国产一区二区三区久久久狼| 国内精品伊人久久久久妇| 久久av高潮av无码av喷吹| 国产亚洲精午夜久久久久久| 国产精品一久久香蕉国产线看| 青青草原综合久久大伊人| 久久精品桃花综合| 色综合久久88色综合天天 | 久久伊人亚洲AV无码网站| 久久人人爽人人澡人人高潮AV |