Ejemplo n.º 1
0
    def pbbdspop(self):
        session = self.request.session
        if session['logged']<>1:
           return HTTPFound(location='/logout') 

        request = self.request
        resource = None
        url=request.resource_url(resource)
        
        datas= osSpop.BlankRow()
        datas['wp_pekerjaan']=osLookup.get_wp_pekerjaan()
        datas['wp_status']=osLookup.get_wp_status()

        if self.request.session['sa']==1:
            datas['opts']=osApps.get_rows()
            opts = osApps.get_rows()
        else:
            pass

        schema = osSpopValid()
        myform = Form(schema, buttons=('submit',))
        if 'btn_save' in self.request.POST:
            controls = self.request.POST.items()
            try:
                appstruct = myform.validate(controls)
            except ValidationFailure, e:
                return {'form':e.render(), 'values': False}
            # Process the valid form data, do some work
            
            data2=dict((x, y) for x, y in controls)
            datas.update(data2)
            print datas
Ejemplo n.º 2
0
def sipkd_init(request, context):
    datas = {}
    datas['title'] = "OpenSIPKD"
    datas['message'] = "Silahkan Isi Form di bawah ini"
    datas['module'] = 'module' in request.session and request.session[
        'module'] or ""
    if 'logged' in request.session and request.session['logged'] == 1:
        datas['usernm'] = request.session['usernm'],
        if request.session['sa'] == 1:
            datas['opts'] = osApps.get_rows()
            opts = osApps.get_rows()
    else:
        datas['usernm'] = ''
        datas['url'] = request.resource_url(context, '/')
        request.session['logged'] = 0
    return datas
Ejemplo n.º 3
0
    def appsgrid(self):
        resource = None
        opts = osApps.get_rows()

        grids = {"aaData": []}
        for opt in opts:
            checked = opt.locked == 1 and "checked" or ""
            grids['aaData'].append([
                opt.id, opt.nama, opt.kode,
                '<input type="checkbox" onchange="update_stat(%d,this.checked);" name="disabled" %s>'
                % (opt.id, checked)
            ])
        return grids
Ejemplo n.º 4
0
    def pbbdspopproses(self):
        session = self.request.session
        if session['logged']<>1:
           return HTTPFound(location='/logout') 

        request = self.request
        resource = None
        url=request.resource_url(resource)
        datas= osSpop.BlankRow()
        datas['wp_pekerjaan']=osLookup.get_wp_pekerjaan()
        datas['wp_status']=osLookup.get_wp_status()

        if self.request.session['sa']==1:
            datas['opts']=osApps.get_rows()
            opts = osApps.get_rows()
        else:
            pass
        return dict(title="OpenSIPKD",
                    message="",
                    usernm=self.request.session['usernm'], 
                    opts=opts,
                    datas=datas,
                    url=url)
        
Ejemplo n.º 5
0
    def apps(self):
        from ..models.apps import osApps
        session = self.request.session
        request = self.request
        datas = sipkd_init(self.request, self.context)
        resource = None
        if session['logged'] <> 1:
            return HTTPFound(location='/logout')
        url = request.resource_url(resource)
        if self.request.session['sa'] == 1:
            opts = osApps.get_rows()
            opts = [dict(nama='ADMIN', kode='admin')]
            print opts
        else:
            pass

        return dict(datas=datas, url=url)
Ejemplo n.º 6
0
    def pbbd(self):
        from sipkd.models.apps import osApps
        session = self.request.session
        request = self.request
        resource = None

        if session['logged']<>1:
           return HTTPFound(location='/logout') 
        url=request.resource_url(resource)

        if self.request.session['sa']==1:
            opts = osApps.get_rows()
        else:
            pass
  
        return dict(title="OpenSIPKD",
                    message="",
                    usernm=self.request.session['usernm'], 
                    opts=opts,
                    url=url)
Ejemplo n.º 7
0
    def pbbd(self):
        from sipkd.models.apps import osApps
        session = self.request.session
        request = self.request
        resource = None

        if session['logged'] <> 1:
            return HTTPFound(location='/logout')
        url = request.resource_url(resource)

        if self.request.session['sa'] == 1:
            opts = osApps.get_rows()
        else:
            pass

        return dict(title="OpenSIPKD",
                    message="",
                    usernm=self.request.session['usernm'],
                    opts=opts,
                    url=url)
Ejemplo n.º 8
0
    def pbbspop(self):
        session = self.request.session
        #if session['logged']<>1:
        #   return HTTPFound(location='/logout') 

        request = self.request
        
        resource = None
        url=request.resource_url(resource)
        datas = sipkd_init(request, self.context)
        datas.update(osSpop.BlankRow())
        datas['wp_pekerjaan']=osLookup.get_wp_pekerjaan()
        datas['wp_status']=osLookup.get_wp_status()

        if self.request.session['sa']==1:
            datas['opts']=osApps.get_rows()
            opts = osApps.get_rows()
        else:
            pass

        schema = osSpopValid()
        myform = Form(schema, buttons=('submit',))
        if 'btn_save' in self.request.POST:
            controls = self.request.POST.items()
            data2=dict((x, y) for x, y in controls)
            datas.update(data2)
            datas['form_visible']= '1'
            datas['readonly'] = 'readonly'
            try:
                appstruct = myform.validate(controls)
            except ValidationFailure, e:
                return dict(title="OpenSIPKD",
                    message="",
                    usernm=self.request.session['usernm'], 
                    opts=opts,
                    datas=datas,
                    url=url)

            # Process the valid form data, do some work
            #try:
            if osDSP.get_by_kode(datas['subjek_pajak_id']):
                osDSP.edit(datas)
            else:
                osDSP.tambah(datas)
                
            if datas['jns_transaksi_op']==1:
                osDOP.tambah(data)
                osDOPBumi.tambah(data)
            elif datas['jns_transaksi_op']==4:
                osDOP.hapus_nop_bersama(data)
            else: 
                osDOP.edit(datas)
                osDOPBumi.edit(datas)
                
                #DBSession.commit()
            #except: 
            #    print "Unexpected error:", sys.exc_info()[0]
            return dict(title="OpenSIPKD",
                message="",
                usernm=self.request.session['usernm'], 
                opts=opts,
                datas=datas,
                url=url)
                    
            data2=cls.BlankRow()
            datas.update(data2)
            datas['form_visible']= '0'
            datas['readonly'] = ''
            return dict(datas=datas,
                url=url)