Ejemplo n.º 1
0
class Iyuedujilu(form.Schema):
    """
    gaiyue you shenbao ji dagou,fouze wei kong
    """
    shenbaofou = schema.Bool(title=_(u"shifou yi shenbao?"),
                             required=False,
                             default=False)
Ejemplo n.º 2
0
class Ijidu(form.Schema):
    """
    jidu jilu base interface
    """
    shenbaofou1 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou2 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou3 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou4 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
Ejemplo n.º 3
0
class Iancijilu(form.Schema):
    """
    gai yue shenbao cishu
    """
    shenbaocishu = schema.Int(title=_(u"gaiyue shenbao cishu"),
                       required=False,
                       default= 0) 
Ejemplo n.º 4
0
class BaseEdit(dexterity.EditForm):
    grok.name('ajaxedit')
    grok.context(Inashuiren)
    label = _(u'Edit nashuiren base info')

    # avoid autoform functionality
    def updateFields(self):
        pass

    @property
    def fields(self):
        return field.Fields(Inashuiren).select('title', 'guanlidaima',
                                               'description', 'dengjiriqi',
                                               'shuiguanyuan', 'danganbianhao',
                                               'xiaoguimo')
Ejemplo n.º 5
0
class Iyuedu(form.Schema):
    """
    yuedu jilu base interface
    """
    shenbaofou1 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou2 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou3 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou4 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou5 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou6 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou7 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou8 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou9 = schema.Bool(title=_(u"shifou yi shenbao?"),
                              required=False,
                              default=False)
    shenbaofou10 = schema.Bool(title=_(u"shifou yi shenbao?"),
                               required=False,
                               default=False)
    shenbaofou11 = schema.Bool(title=_(u"shifou yi shenbao?"),
                               required=False,
                               default=False)
    shenbaofou12 = schema.Bool(title=_(u"shifou yi shenbao?"),
                               required=False,
                               default=False)
Ejemplo n.º 6
0
class Ianci(form.Schema):
    """
    anci base interface
    """
    shenbaocishu1 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu2 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu3 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu4 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu5 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu6 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu7 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu8 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu9 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                               required=False,
                               default=0)
    shenbaocishu10 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                                required=False,
                                default=0)
    shenbaocishu11 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                                required=False,
                                default=0)
    shenbaocishu12 = schema.Int(title=_(u"gaiyue shenbao cishu"),
                                required=False,
                                default=0)
Ejemplo n.º 7
0
class Inashuiren(form.Schema,IBasic):
    """
    na shui ren niandu sheshui shenbao jilu
    """
# 纳税人名称/所属科室/税管员、税务登记日期
    dexteritytextindexer.searchable('title')
    title = schema.TextLine(title=_(u"nashuiren mingcheng"),
                             default=u"",
                             required=True,)
#主管税务所(科、分局)    
    description = schema.TextLine(title=_(u"nashuiren suoshu keshi"),
                             default=u"",
                             required=True,)
#   税务登记日期 
    dengjiriqi = schema.Date(
        title=_(u"dengji riqi"),
        description=u'',
        required=True,)        
#主管税务机关
    zhuguanshuiwujiguan = schema.TextLine(title=_(u"zhu guan shuiwu jiguan"),
                             default=u"",
                             required=False,)


#税收管理员
    shuiguanyuan = schema.TextLine(title=_(u"shuishou guanlirenyuan"),
                             default=u"",
                             required=False,)

#当前报表年度           
    year = schema.TextLine(title=_(u"niandu"),
                             default=u"2012",
                             required=False,)
#管理代码    
    dexteritytextindexer.searchable('guanlidaima')
    guanlidaima = schema.ASCIILine(
            title=_(u"guanli daima"),
            description=_(u"shehui xingren daima (nashuiren shibiehao)"),
            required=True)
#档案编号     
    danganbianhao = schema.ASCIILine(
            title=_(u"dangan bianhao"),
            required=False)
#小规模认定
    xiaoguimo = schema.Bool(title=_(u"xiao guimo nashuiren rending"),
                       required=False,
                       default=False)
#年度记录
    yinhuashui = schema.Bool(title=_(u"yinhuashui shenbaobiao(yingyezhangbo)"),
                       required=False,
                       default=False)
    chechuanshui = schema.Bool(title=_(u"chechuanshui shenbaobiao"),
                       required=False,
                       default=False)
    canjirenbaozhengjin = schema.Bool(title=_(u"canjirenbaozhengjin shenbaobiao"),
                       required=False,
                       default=False)
    difangshuihuisuan = schema.Bool(title=_(u"difang geshui huisuan qingjiaobiao"),
                       required=False,
                       default=False)    
    gerensuodeshuiniandu = schema.Bool(title=_(u"geren suodeshui niandu shenbaobiao"),
                       required=False,
                       default=False)
    qiyesuodeshuiniandu = schema.Bool(title=_(u"qiye suodeshui niandu shenbaobiao ji huisuan qinjiao fudaojilu"),
                       required=False,
                       default=False)
    zhuxiaoshuiwudengji = schema.Bool(title=_(u"zhuxiao shuiwu dengjibiao"),
                       required=False,
                       default=False)
    feizhenghurending = schema.Bool(title=_(u"fei zhenghu rending biao"),
                       required=False,
                       default=False)

    
    
    form.omitted('year','zhuguanshuiwujiguan')
Ejemplo n.º 8
0
    def importData(self):
        """Import Data from CSV file.

        In case of error, return a CSV file filled with the lines where
        errors occured.
        """

        file_upload = self.request.form.get('csv_upload', None)
        if file_upload is None or not file_upload.filename:
            return
        reader = csv.reader(file_upload)
#         import pdb
#         pdb.set_trace()
        header = reader.next()
        if header != data_VALUES:
            msg = _('Wrong specification of the CSV file. Please correct it and retry.')
            type = 'error'
            IStatusMessage(self.request).addStatusMessage(msg, type=type)
            return

        validLines = []
        invalidLines = []
        for line in reader:
#            datas = dict(zip(header, line))
            validLines.append(line)
        usersNumber = 0
        
        for line in validLines:
#            datas = dict(zip(header, line))
            datas = dict(zip(data_PROPERTIES, line))  
            
            try:
#                映射数据到纳税人字段
                title = datas['title']
                if not isinstance(title, unicode):
                    name = unicode(title, 'utf-8')
#                 id = IUserPreferredFileNameNormalizer(self.request).normalize(filename)
                id = datas['guanlidaima']

                id = self.float2str(id,"E+")
                if self.IdIsExist(id):continue
                title = name
                guanlidaima = id                
                dengjiriqi = datas.pop('dengjiriqi')
                if ' ' in dengjiriqi:
                    dengjiriqi = dengjiriqi.split(' ')[0]
#                 import pdb
#                 pdb.set_trace()
                description = datas.pop('description')
                shuiguanyuan = datas['shuiguanyuan']
                danganbianhao = ""                
#                 danganbianhao = datas.pop('danganbianhao')
#                 danganbianhao = self.float2str(danganbianhao,"E+")                
# send a add nashuiren event
                try:
                    event.notify(CreateNashuirenEvent(
                                                id,title,guanlidaima,dengjiriqi,description,
                                                shuiguanyuan,danganbianhao))

                except (AttributeError, ValueError), err:
                    logging.exception(err)
                    IStatusMessage(self.request).addStatusMessage(err, type="error")
                    return
                usersNumber += 1
            except:
Ejemplo n.º 9
0
                                                shuiguanyuan,danganbianhao))

                except (AttributeError, ValueError), err:
                    logging.exception(err)
                    IStatusMessage(self.request).addStatusMessage(err, type="error")
                    return
                usersNumber += 1
            except:
                invalidLines.append(line)
                print "Invalid line: %s" % line

        if invalidLines:
            datafile = self._createCSV(invalidLines)
            self.request['csverrors'] = True
            self.request.form['nashuiren_sheet_errors'] = datafile.getvalue()
            msg = _('Some errors occured. Please check your CSV syntax and retry.')
            type = 'error'
        else:
            msg, type = _('Data successfully imported.'), 'info'

        IStatusMessage(self.request).addStatusMessage(msg, type=type)
        self.request['users_results'] = usersNumber
        return self.index()

    def getCSVWithErrors(self):
        """Return a CSV file that contains lines witch failed."""

        users_sheet_errors = self.request.form.get('nashuiren_sheet_errors', None)
        if users_sheet_errors is None:
            return # XXX
        return self._createRequest(users_sheet_errors, "nashuiren_sheet_errors.csv")